• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 NATIVE_RDB_RDB_ERRNO_H
17 #define NATIVE_RDB_RDB_ERRNO_H
18 #include <errors.h>
19 namespace OHOS {
20 namespace NativeRdb {
21 
22 constexpr ErrCode DISTRIBUTEDDATAMGR_RDB_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDDATAMNG, 2);
23 /**
24 * @brief The error code in the correct case.
25 */
26 constexpr int E_OK = 0;
27 
28 /**
29 * @brief The base code of the exception error code.
30 */
31 constexpr int E_BASE = DISTRIBUTEDDATAMGR_RDB_ERR_OFFSET;
32 
33 /**
34 * @brief The error when the capability not supported.
35 */
36 constexpr int E_NOT_SUPPORT = (E_BASE + 801);
37 
38 /**
39 * @brief The error code for common exceptions.
40 */
41 constexpr int E_ERROR = E_BASE;
42 
43 /**
44 * @brief The error code for common invalid args.
45 */
46 constexpr int E_INVALID_ARGS = (E_BASE + 0x1);
47 
48 /**
49 * @brief The error code for upgrade the read-only store.
50 */
51 constexpr int E_CANNOT_UPDATE_READONLY = (E_BASE + 0x2);
52 
53 /**
54 * @brief The error code when deleting a file fails.
55 */
56 constexpr int E_REMOVE_FILE = (E_BASE + 0x3);
57 
58 /**
59 * @brief The error code indicates that the SQL statement is incorrect.
60 */
61 constexpr int E_INCORRECT_SQL = (E_BASE + 0x4);
62 
63 /**
64 * @brief The error code for a table name is empty.
65 */
66 constexpr int E_EMPTY_TABLE_NAME = (E_BASE + 0x5);
67 
68 /**
69 * @brief The error code for a values bucket is empty.
70 */
71 constexpr int E_EMPTY_VALUES_BUCKET = (E_BASE + 0x6);
72 
73 /**
74 * @brief The error code when the sql is not select.
75 */
76 constexpr int E_NOT_SELECT = (E_BASE + 0x7);
77 
78 /**
79 * @brief The error code for the column out of bounds.
80 */
81 constexpr int E_COLUMN_OUT_RANGE = (E_BASE + 0x8);
82 
83 /**
84 * @brief The error code for the column type is invalid.
85 */
86 constexpr int E_INVALID_COLUMN_TYPE = (E_BASE + 0x9);
87 
88 /**
89 * @brief The error code for a file name is empty.
90 */
91 constexpr int E_EMPTY_FILE_NAME = (E_BASE + 0xa);
92 
93 /**
94 * @brief The error for the current file path is invalid.
95 */
96 constexpr int E_INVALID_FILE_PATH = (E_BASE + 0xb);
97 
98 /**
99 * @brief The error code when using transactions.
100 */
101 constexpr int E_TRANSACTION_IN_EXECUTE = (E_BASE + 0xc);
102 
103 /**
104 * @brief The error code for the row out of bounds.
105 */
106 constexpr int E_ROW_OUT_RANGE = (E_BASE + 0xd);
107 
108 /**
109 * @brief The error code when execute write operation in read connection.
110 */
111 constexpr int E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 0xe);
112 
113 /**
114 * @brief The error code for execute begin transaction operation in read connection.
115 */
116 constexpr int E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 0xf);
117 
118 /**
119 * @brief The error code for there are no transactions in this connection.
120 */
121 constexpr int E_NO_TRANSACTION_IN_SESSION = (E_BASE + 0x10);
122 
123 /**
124 * @brief The error code when begin more step query in one session.
125 */
126 constexpr int E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 0x11);
127 
128 /**
129 * @brief The error code when the current statement doesn't contains one row result data.
130 */
131 constexpr int E_NO_ROW_IN_QUERY = (E_BASE + 0x12);
132 
133 /**
134 * @brief The error code for the bind arguments count is invalid.
135 */
136 constexpr int E_INVALID_BIND_ARGS_COUNT = (E_BASE + 0x13);
137 
138 /**
139 * @brief The error code for the object type is invalid.
140 */
141 constexpr int E_INVALID_OBJECT_TYPE = (E_BASE + 0x14);
142 
143 /**
144 * @brief The error code for the conflict flag is invalid.
145 */
146 constexpr int E_INVALID_CONFLICT_FLAG = (E_BASE + 0x15);
147 
148 /**
149 * @brief The error code for having clause not in group.
150 */
151 constexpr int E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 0x16);
152 
153 /**
154 * @brief The error code for not supported by step result set.
155 */
156 constexpr int E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 0x17);
157 
158 /**
159 * @brief The error code for step result current tid not equal to object's tid.
160 */
161 constexpr int E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 0x18);
162 
163 /**
164 * @brief The error code when the result query was not executed.
165 */
166 constexpr int E_NOT_INIT = (E_BASE + 0x19);
167 
168 /**
169 * @brief The error code for the result set cursor is after the last row.
170 */
171 constexpr int E_NO_MORE_ROWS = (E_BASE + 0x1a);
172 
173 /**
174 * @brief The error code for the result set query exceeded.
175 */
176 constexpr int E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 0x1b);
177 
178 /**
179 * @brief The error code for the statement not prepared.
180 */
181 constexpr int E_STATEMENT_NOT_PREPARED = (E_BASE + 0x1c);
182 
183 /**
184 * @brief The error code for the result set is incorrect.
185 */
186 constexpr int E_EXECUTE_RESULT_INCORRECT = (E_BASE + 0x1d);
187 
188 /**
189 * @brief The error code when the result set is closed.
190 */
191 constexpr int E_ALREADY_CLOSED = (E_BASE + 0x1e);
192 
193 /**
194 * @brief The error code when input relative path.
195 */
196 constexpr int E_RELATIVE_PATH = (E_BASE + 0x1f);
197 
198 /**
199 * @brief The error code for the new encrypt key is empty.
200 */
201 constexpr int E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 0x20);
202 
203 /**
204 * @brief The error code for change unencrypted to encrypted.
205 */
206 constexpr int E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 0x21);
207 
208 /**
209 * @brief The error code for database busy.
210 */
211 constexpr int E_DATABASE_BUSY = (E_BASE + 0x22);
212 
213 /**
214 * @brief The error code when the statement not initialized.
215 */
216 constexpr int E_STORE_CLOSED = (E_BASE + 0x23);
217 
218 /**
219 * @brief The error code for the attach is not supported in WAL journal mode.
220 */
221 constexpr int E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 0x24);
222 
223 /**
224 * @brief The error code when create folder failed.
225 */
226 constexpr int E_CREATE_FOLDER_FAIL = (E_BASE + 0x25);
227 
228 /**
229 * @brief The error for SQL builder normalize failed.
230 */
231 constexpr int E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 0x26);
232 
233 /**
234 * @brief The error for store session not give connection temporarily.
235 */
236 constexpr int E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 0x27);
237 
238 /**
239 * @brief The error for store session not current transaction.
240 */
241 constexpr int E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 0x28);
242 
243 /**
244 * @brief The error for not supported the current operation.
245 */
246 constexpr int E_NOT_SUPPORTED = (E_BASE + 0x29);
247 
248 /**
249 * @brief The error for the current parcel is invalid.
250 */
251 constexpr int E_INVALID_PARCEL = (E_BASE + 0x2a);
252 
253 /**
254 * @brief The error code when using sqlite3_step function failed.
255 */
256 constexpr int E_QUERY_IN_EXECUTE = (E_BASE + 0x2b);
257 
258 /**
259 * @brief The error for set persist WAL.
260 */
261 constexpr int E_SET_PERSIST_WAL = (E_BASE + 0x2c);
262 
263 /**
264 * @brief The error when the database does not exist.
265 */
266 constexpr int E_DB_NOT_EXIST = (E_BASE + 0x2d);
267 
268 /**
269 * @brief The error when the read connection count is overload.
270 */
271 constexpr int E_ARGS_READ_CON_OVERLOAD = (E_BASE + 0x2e);
272 
273 /**
274 * @brief The error when the wal file size over default limit.
275 */
276 static constexpr int E_WAL_SIZE_OVER_LIMIT = (E_BASE + 0x2f);
277 
278 /**
279 * @brief The error when the connection count is used up.
280 */
281 static constexpr int E_CON_OVER_LIMIT = (E_BASE + 0x30);
282 
283 /**
284 * @brief The error when the sharedblock unit is null.
285 */
286 static constexpr int E_NULL_OBJECT = (E_BASE + 0x31);
287 
288 /**
289 * @brief Failed to get DataObsMgrClient.
290 */
291 static constexpr int E_GET_DATAOBSMGRCLIENT_FAIL = (E_BASE + 0x32);
292 
293 /**
294  * @brief The error when the type of the distributed table does not match.
295  */
296 static constexpr int E_TYPE_MISMATCH = (E_BASE + 0x33);
297 
298 /**
299  * @brief Insertion failed because database is full.
300  */
301 static constexpr int E_SQLITE_FULL = (E_BASE + 0x34);
302 
303 /**
304  * @brief The error when sql is not supported in execute
305  */
306 static constexpr int E_NOT_SUPPORT_THE_SQL = (E_BASE + 0x35);
307 
308 /**
309  * @brief The database alias already exists.
310  */
311 static constexpr int E_ATTACHED_DATABASE_EXIST = (E_BASE + 0x36);
312 
313 /**
314  * @brief Generic error.
315  */
316 static constexpr int E_SQLITE_ERROR = (E_BASE + 0x37);
317 
318 /**
319  * @brief The database disk image is malformed. Used by vector db, too.
320  */
321 static constexpr int E_SQLITE_CORRUPT = (E_BASE + 0x38);
322 
323 /**
324  * @brief The error when unlocking data needs to be compensated sync
325  */
326 static constexpr int E_WAIT_COMPENSATED_SYNC = (E_BASE + 0x39);
327 
328 /**
329  * @brief Callback routine requested an abort.
330  */
331 static constexpr int E_SQLITE_ABORT = (E_BASE + 0x3a);
332 
333 /**
334  * @brief Access permission denied.
335  */
336 static constexpr int E_SQLITE_PERM = (E_BASE + 0x3b);
337 
338 /**
339  * @brief The database file is locked.
340  */
341 static constexpr int E_SQLITE_BUSY = (E_BASE + 0x3c);
342 
343 /**
344  * @brief A table in the database is locked.
345  */
346 static constexpr int E_SQLITE_LOCKED = (E_BASE + 0x3d);
347 
348 /**
349  * @brief A malloc() failed.
350  */
351 static constexpr int E_SQLITE_NOMEM = (E_BASE + 0x3e);
352 
353 /**
354  * @brief Attempt to write a readonly database.
355  */
356 static constexpr int E_SQLITE_READONLY = (E_BASE + 0x3f);
357 
358 /**
359  * @brief Some kind of disk I/O error occurred.
360  */
361 static constexpr int E_SQLITE_IOERR = (E_BASE + 0x40);
362 
363 /**
364  * @brief Unable to open the database file.
365  */
366 static constexpr int E_SQLITE_CANTOPEN = (E_BASE + 0x41);
367 
368 /**
369  * @brief String or BLOB exceeds size limit.
370  */
371 static constexpr int E_SQLITE_TOOBIG = (E_BASE + 0x42);
372 
373 /**
374  * @brief Abort due to constraint violation.
375  */
376 static constexpr int E_SQLITE_CONSTRAINT = (E_BASE + 0x43);
377 
378 /**
379  * @brief Data type mismatch.
380  */
381 static constexpr int E_SQLITE_MISMATCH = (E_BASE + 0x44);
382 
383 /**
384  * @brief Library used incorrectly.
385  */
386 static constexpr int E_SQLITE_MISUSE = (E_BASE + 0x45);
387 
388 /**
389  * @brief Config changed.
390  */
391 static constexpr int E_CONFIG_INVALID_CHANGE = (E_BASE + 0x46);
392 
393 /**
394  * @brief Not get service.
395  */
396 static constexpr int E_SERVICE_NOT_FOUND = (E_BASE + 0x47);
397 
398 /**
399  * @brief Database schema has changed.
400  */
401 static constexpr int E_SQLITE_SCHEMA = (E_BASE + 0x48);
402 
403 /**
404  * @brief Operation cancel.
405  */
406 static constexpr int E_CANCEL = (E_BASE + 0x49);
407 
408 /**
409  * @brief The secret key is corrupted or lost.
410  */
411 static constexpr int E_INVALID_SECRET_KEY = (E_BASE + 0x4a);
412 
413 /**
414  * @brief No space left on device
415  */
416 static constexpr int E_SQLITE_IOERR_FULL = (E_BASE + 0x4b);
417 
418 /**
419  * @brief Do not use except relational_store
420  */
421 static constexpr int E_INNER_WARNING = (E_BASE + 0x4c);
422 
423 /**
424  * @brief This is not a database file.
425  */
426 static constexpr int E_SQLITE_NOT_DB = (E_BASE + 0x4d);
427 
428 /**
429  * @brief The root key of the encrypted database is faulty.
430  */
431 static constexpr int E_ROOT_KEY_FAULT = (E_BASE + 0x4e);
432 
433 /**
434  * @brief The root key of the encrypted database cannot be loaded.
435  */
436 static constexpr int E_ROOT_KEY_NOT_LOAD = (E_BASE + 0x4f);
437 
438 /**
439  * @brief The working key of the encrypted database is faulty.
440  */
441 static constexpr int E_WORK_KEY_FAIL = (E_BASE + 0x50);
442 
443 /**
444  * @brief Failed to encrypt the working key.
445  */
446 static constexpr int E_WORK_KEY_ENCRYPT_FAIL = (E_BASE + 0x51);
447 
448 /**
449  * @brief Failed to decrypt the working key.
450  */
451 static constexpr int E_WORK_KEY_DECRYPT_FAIL = (E_BASE + 0x52);
452 
453 /**
454  * @brief Failed to open the sqlite database using the working key.
455  */
456 static constexpr int E_SET_ENCRYPT_FAIL = (E_BASE + 0x53);
457 
458 /**
459  * @brief Failed to open the sqlite database using the working new key.
460  */
461 static constexpr int E_SET_NEW_ENCRYPT_FAIL = (E_BASE + 0x54);
462 
463 /**
464  * @brief Failed to open the sqlite database using the working service key.
465  */
466 static constexpr int E_SET_SERVICE_ENCRYPT_FAIL = (E_BASE + 0x55);
467 
468 /**
469  * @brief Database WAL file check point failed.
470  */
471 static constexpr int E_CHECK_POINT_FAIL = (E_BASE + 0x56);
472 
473 /**
474 * @brief The error code for common invalid args.
475 */
476 static constexpr int E_INVALID_ARGS_NEW = (E_BASE + 0x58);
477 } // namespace NativeRdb
478 } // namespace OHOS
479 
480 #endif
481