• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RELATIONAL_STORE_ERRNO_CODE_H
17 #define RELATIONAL_STORE_ERRNO_CODE_H
18 
19 /**
20  * @addtogroup RDB
21  * @{
22  *
23  * @brief The relational database (RDB) store manages data based on relational models.
24  * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases.
25  * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations
26  * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements.
27  *
28  * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
29  * @since 10
30  */
31 
32 /**
33  * @file relational_store_error_code.h
34  *
35  * @brief Declaration error code information.
36  *
37  * @since 10
38  */
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * @brief Indicates the error code information.
46  *
47  * @since 10
48  */
49 typedef enum OH_Rdb_ErrCode {
50     /**
51      * Indicates that the function execution exception.
52      */
53     RDB_ERR = -1,
54 
55     /**
56      * The error code in the correct case.
57      */
58     RDB_OK = 0,
59 
60     /**
61      * @brief The base code of the exception error code.
62      */
63     E_BASE = 14800000,
64 
65     /**
66      * @brief The error when the capability not supported.
67      */
68     RDB_E_NOT_SUPPORTED = 801,
69 
70     /**
71      * @brief The error code for common exceptions.
72      */
73     RDB_E_ERROR = E_BASE,
74 
75     /**
76      * @brief The error code for common invalid args.
77      */
78     RDB_E_INVALID_ARGS = (E_BASE + 1),
79 
80     /**
81      * @brief The error code for upgrade the read-only store.
82      */
83     RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2),
84 
85     /**
86      * @brief The error code when deleting a file fails.
87      */
88     RDB_E_REMOVE_FILE = (E_BASE + 3),
89 
90     /**
91      * @brief The error code for a table name is empty.
92      */
93     RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5),
94 
95     /**
96      * @brief The error code for a values bucket is empty.
97      */
98     RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6),
99 
100     /**
101      * @brief The error code when the sql is not select.
102      */
103     RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7),
104 
105     /**
106      * @brief The error code for the column index is invalid.
107      */
108     RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8),
109 
110     /**
111      * @brief The error code for the column type is invalid.
112      */
113     RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9),
114 
115     /**
116      * @brief The error code for a file name is empty.
117      */
118     RDB_E_EMPTY_FILE_NAME = (E_BASE + 10),
119 
120     /**
121      * @brief The error for the current file path is invalid.
122      */
123     RDB_E_INVALID_FILE_PATH = (E_BASE + 11),
124 
125     /**
126      * @brief The error code when using transactions.
127      */
128     RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12),
129 
130     /**
131      * @brief The error code for the current status is invalid.
132      */
133     RDB_E_INVALID_STATEMENT = (E_BASE + 13),
134 
135     /**
136      * @brief The error code when execute write operation in read connection.
137      */
138     RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14),
139 
140     /**
141      * @brief The error code for execute begin transaction operation in read connection.
142      */
143     RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15),
144 
145     /**
146      * @brief The error code for there are no transactions in this connection.
147      */
148     RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16),
149 
150     /**
151      * @brief The error code when begin more step query in one session.
152      */
153     RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17),
154 
155     /**
156      * @brief The error code when the current statement doesn't contains one row result data.
157      */
158     RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18),
159 
160     /**
161      * @brief The error code for the bind arguments count is invalid.
162      */
163     RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19),
164 
165     /**
166      * @brief The error code for the object type is invalid.
167      */
168     RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20),
169 
170     /**
171      * @brief The error code for the conflict flag is invalid.
172      */
173     RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21),
174 
175     /**
176      * @brief The error code for having clause not in group.
177      */
178     RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22),
179 
180     /**
181      * @brief The error code for not supported by step result set.
182      */
183     RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23),
184 
185     /**
186      * @brief The error code for step result current tid not equal to object's tid.
187      */
188     RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24),
189 
190     /**
191      * @brief The error code when the result query was not executed.
192      */
193     RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25),
194 
195     /**
196      * @brief The error code for the result set cursor is after the last row.
197      */
198     RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26),
199 
200     /**
201      * @brief The error code for the result set query exceeded.
202      */
203     RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27),
204 
205     /**
206      * @brief The error code for the statement not prepared.
207      */
208     RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28),
209 
210     /**
211      * @brief The error code for the result set is incorrect.
212      */
213     RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29),
214 
215     /**
216      * @brief The error code when the result set is closed.
217      */
218     RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30),
219 
220     /**
221      * @brief The error code when input relative path.
222      */
223     RDB_E_RELATIVE_PATH = (E_BASE + 31),
224 
225     /**
226      * @brief The error code for the new encrypt key is empty.
227      */
228     RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32),
229 
230     /**
231      * @brief The error code for change unencrypted to encrypted.
232      */
233     RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33),
234 
235     /**
236      * @brief The error code for change encrypt in busy.
237      */
238     RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34),
239 
240     /**
241      * @brief The error code when the statement not initialized.
242      */
243     RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35),
244 
245     /**
246      * @brief The error code for the attach is not supported in WAL journal mode.
247      */
248     RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36),
249 
250     /**
251      * @brief The error code when create folder failed.
252      */
253     RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37),
254 
255     /**
256      * @brief The error for SQL builder normalize failed.
257      */
258     RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38),
259 
260     /**
261      * @brief The error for store session not give connection temporarily.
262      */
263     RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39),
264 
265     /**
266      * @brief The error for store session not current transaction.
267      */
268     RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40),
269 
270     /**
271      * @brief The error for not supported the current operation.
272      */
273     RDB_E_NOT_SUPPORT = (E_BASE + 41),
274 
275     /**
276      * @brief The error for the current parcel is invalid.
277      */
278     RDB_E_INVALID_PARCEL = (E_BASE + 42),
279 
280     /**
281      * @brief The error code when using sqlite3_step function failed.
282      */
283     RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43),
284 
285     /**
286      * @brief The error for set persist WAL.
287      */
288     RDB_E_SET_PERSIST_WAL = (E_BASE + 44),
289 
290     /**
291      * @brief The error when the database does not exist.
292      */
293     RDB_E_DB_NOT_EXIST = (E_BASE + 45),
294 
295     /**
296      * @brief The error when the read connection count is overload.
297      */
298     RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46),
299 
300     /**
301      * @brief The error when the wal file size over default limit.
302      */
303     RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47),
304 
305     /**
306      * @brief The error when the connection count is used up.
307      */
308     RDB_E_CON_OVER_LIMIT = (E_BASE + 48),
309 
310     /**
311      * @brief The secret key is corrupted or lost.
312      */
313     RDB_E_INVALID_SECRET_KEY = (E_BASE + 49),
314 
315     /**
316      * @brief Database already closed.
317      *
318      * @since 18
319      */
320     RDB_E_ALREADY_CLOSED = (E_BASE + 50),
321 
322     /**
323      * @brief The database does not respond.
324      *
325      * @since 18
326      */
327     RDB_E_DATABASE_BUSY = (E_BASE + 51),
328 
329     /**
330      * @brief Database corrupted.
331      *
332      * @since 18
333      */
334     RDB_E_SQLITE_CORRUPT = (E_BASE + 52),
335 
336     /**
337      * @brief SQLite: Access permission denied.
338      *
339      * @since 18
340      */
341     RDB_E_SQLITE_PERM = (E_BASE + 53),
342 
343     /**
344      * @brief SQLite: The database file is locked.
345      *
346      * @since 18
347      */
348     RDB_E_SQLITE_BUSY = (E_BASE + 54),
349 
350     /**
351      * @brief SQLite: A table in the database is locked.
352      *
353      * @since 18
354      */
355     RDB_E_SQLITE_LOCKED = (E_BASE + 55),
356 
357     /**
358      * @brief SQLite: The database is out of memory.
359      *
360      * @since 18
361      */
362     RDB_E_SQLITE_NOMEM = (E_BASE + 56),
363 
364     /**
365      * @brief SQLite: Attempt to write a readonly database.
366      *
367      * @since 18
368      */
369     RDB_E_SQLITE_READONLY = (E_BASE + 57),
370 
371     /**
372      * @brief SQLite: Some kind of disk I/O error occurred.
373      *
374      * @since 18
375      */
376     RDB_E_SQLITE_IOERR = (E_BASE + 58),
377 
378     /**
379      * @brief SQLite: The database is full.
380      *
381      * @since 18
382      */
383     RDB_E_SQLITE_FULL = (E_BASE + 59),
384 
385     /**
386      * @brief SQLite: Unable to open the database file.
387      *
388      * @since 18
389      */
390     RDB_E_SQLITE_CANT_OPEN = (E_BASE + 60),
391 
392     /**
393      * @brief SQLite: TEXT or BLOB exceeds size limit.
394      *
395      * @since 18
396      */
397     RDB_E_SQLITE_TOO_BIG = (E_BASE + 61),
398 
399     /**
400      * @brief SQLite: Data type mismatch.
401      *
402      * @since 18
403      */
404     RDB_E_SQLITE_MISMATCH = (E_BASE + 62),
405 
406     /**
407      * @brief Data value type is null.
408      *
409      * @since 18
410      */
411     RDB_E_DATA_TYPE_NULL = (E_BASE + 63),
412 
413     /**
414      * @brief Data value type mismatch.
415      *
416      * @since 18
417      */
418     RDB_E_TYPE_MISMATCH = (E_BASE + 64),
419 
420     /**
421      * @brief SQLite: Abort due to constraint violation.
422      *
423      * @since 18
424      */
425     RDB_E_SQLITE_CONSTRAINT = (E_BASE + 65),
426 } OH_Rdb_ErrCode;
427 
428 #ifdef __cplusplus
429 };
430 #endif
431 
432 #endif // RELATIONAL_STORE_ERRNO_CODE_H
433