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 + 1); 47 48 /** 49 * @brief The error code for upgrade the read-only store. 50 */ 51 constexpr int E_CANNOT_UPDATE_READONLY = (E_BASE + 2); 52 53 /** 54 * @brief The error code when deleting a file fails. 55 */ 56 constexpr int E_REMOVE_FILE = (E_BASE + 3); 57 58 /** 59 * @brief The error code indicates that the SQL statement is incorrect. 60 */ 61 constexpr int E_INCORRECT_SQL = (E_BASE + 4); 62 63 /** 64 * @brief The error code for a table name is empty. 65 */ 66 constexpr int E_EMPTY_TABLE_NAME = (E_BASE + 5); 67 68 /** 69 * @brief The error code for a values bucket is empty. 70 */ 71 constexpr int E_EMPTY_VALUES_BUCKET = (E_BASE + 6); 72 73 /** 74 * @brief The error code when the sql is not select. 75 */ 76 constexpr int E_NOT_SELECT = (E_BASE + 7); 77 78 /** 79 * @brief The error code for the column out of bounds. 80 */ 81 constexpr int E_COLUMN_OUT_RANGE = (E_BASE + 8); 82 83 /** 84 * @brief The error code for the column type is invalid. 85 */ 86 constexpr int E_INVALID_COLUMN_TYPE = (E_BASE + 9); 87 88 /** 89 * @brief The error code for a file name is empty. 90 */ 91 constexpr int E_EMPTY_FILE_NAME = (E_BASE + 10); 92 93 /** 94 * @brief The error for the current file path is invalid. 95 */ 96 constexpr int E_INVALID_FILE_PATH = (E_BASE + 11); 97 98 /** 99 * @brief The error code when using transactions. 100 */ 101 constexpr int E_TRANSACTION_IN_EXECUTE = (E_BASE + 12); 102 103 /** 104 * @brief The error code for the row out of bounds. 105 */ 106 constexpr int E_ROW_OUT_RANGE = (E_BASE + 13); 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 + 14); 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 + 15); 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 + 16); 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 + 17); 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 + 18); 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 + 19); 137 138 /** 139 * @brief The error code for the object type is invalid. 140 */ 141 constexpr int E_INVALID_OBJECT_TYPE = (E_BASE + 20); 142 143 /** 144 * @brief The error code for the conflict flag is invalid. 145 */ 146 constexpr int E_INVALID_CONFLICT_FLAG = (E_BASE + 21); 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 + 22); 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 + 23); 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 + 24); 162 163 /** 164 * @brief The error code when the result query was not executed. 165 */ 166 constexpr int E_NOT_INIT = (E_BASE + 25); 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 + 26); 172 173 /** 174 * @brief The error code for the result set query exceeded. 175 */ 176 constexpr int E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27); 177 178 /** 179 * @brief The error code for the statement not prepared. 180 */ 181 constexpr int E_STATEMENT_NOT_PREPARED = (E_BASE + 28); 182 183 /** 184 * @brief The error code for the result set is incorrect. 185 */ 186 constexpr int E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29); 187 188 /** 189 * @brief The error code when the result set is closed. 190 */ 191 constexpr int E_ALREADY_CLOSED = (E_BASE + 30); 192 193 /** 194 * @brief The error code when input relative path. 195 */ 196 constexpr int E_RELATIVE_PATH = (E_BASE + 31); 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 + 32); 202 203 /** 204 * @brief The error code for change unencrypted to encrypted. 205 */ 206 constexpr int E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33); 207 208 /** 209 * @brief The error code for database busy. 210 */ 211 constexpr int E_DATABASE_BUSY = (E_BASE + 34); 212 213 /** 214 * @brief The error code when the statement not initialized. 215 */ 216 constexpr int E_STORE_CLOSED = (E_BASE + 35); 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 + 36); 222 223 /** 224 * @brief The error code when create folder failed. 225 */ 226 constexpr int E_CREATE_FOLDER_FAIL = (E_BASE + 37); 227 228 /** 229 * @brief The error for SQL builder normalize failed. 230 */ 231 constexpr int E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38); 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 + 39); 237 238 /** 239 * @brief The error for store session not current transaction. 240 */ 241 constexpr int E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40); 242 243 /** 244 * @brief The error for not supported the current operation. 245 */ 246 constexpr int E_NOT_SUPPORTED = (E_BASE + 41); 247 248 /** 249 * @brief The error for the current parcel is invalid. 250 */ 251 constexpr int E_INVALID_PARCEL = (E_BASE + 42); 252 253 /** 254 * @brief The error code when using sqlite3_step function failed. 255 */ 256 constexpr int E_QUERY_IN_EXECUTE = (E_BASE + 43); 257 258 /** 259 * @brief The error for set persist WAL. 260 */ 261 constexpr int E_SET_PERSIST_WAL = (E_BASE + 44); 262 263 /** 264 * @brief The error when the database does not exist. 265 */ 266 constexpr int E_DB_NOT_EXIST = (E_BASE + 45); 267 268 /** 269 * @brief The error when the read connection count is overload. 270 */ 271 constexpr int E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46); 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 + 47); 277 278 /** 279 * @brief The error when the connection count is used up. 280 */ 281 static constexpr int E_CON_OVER_LIMIT = (E_BASE + 48); 282 283 /** 284 * @brief The error when the sharedblock unit is null. 285 */ 286 static constexpr int E_NULL_OBJECT = (E_BASE + 49); 287 288 /** 289 * @brief Failed to get DataObsMgrClient. 290 */ 291 static constexpr int E_GET_DATAOBSMGRCLIENT_FAIL = (E_BASE + 50); 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 + 51); 297 298 /** 299 * @brief Insertion failed because database is full. 300 */ 301 static constexpr int E_SQLITE_FULL = (E_BASE + 52); 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 + 53); 307 308 /** 309 * @brief The database is already attached. 310 */ 311 static constexpr int E_ATTACHED_DATABASE_EXIST = (E_BASE + 54); 312 313 /** 314 * @brief Generic error. 315 */ 316 static constexpr int E_SQLITE_ERROR = (E_BASE + 55); 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 + 56); 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 + 57); 327 328 /** 329 * @brief Callback routine requested an abort. 330 */ 331 static constexpr int E_SQLITE_ABORT = (E_BASE + 58); 332 333 /** 334 * @brief Access permission denied. 335 */ 336 static constexpr int E_SQLITE_PERM = (E_BASE + 59); 337 338 /** 339 * @brief The database file is locked. 340 */ 341 static constexpr int E_SQLITE_BUSY = (E_BASE + 60); 342 343 /** 344 * @brief A table in the database is locked. 345 */ 346 static constexpr int E_SQLITE_LOCKED = (E_BASE + 61); 347 348 /** 349 * @brief A malloc() failed. 350 */ 351 static constexpr int E_SQLITE_NOMEM = (E_BASE + 62); 352 353 /** 354 * @brief Attempt to write a readonly database. 355 */ 356 static constexpr int E_SQLITE_READONLY = (E_BASE + 63); 357 358 /** 359 * @brief Some kind of disk I/O error occurred. 360 */ 361 static constexpr int E_SQLITE_IOERR = (E_BASE + 64); 362 363 /** 364 * @brief Unable to open the database file. 365 */ 366 static constexpr int E_SQLITE_CANTOPEN = (E_BASE + 65); 367 368 /** 369 * @brief String or BLOB exceeds size limit. 370 */ 371 static constexpr int E_SQLITE_TOOBIG = (E_BASE + 66); 372 373 /** 374 * @brief Abort due to constraint violation. 375 */ 376 static constexpr int E_SQLITE_CONSTRAINT = (E_BASE + 67); 377 378 /** 379 * @brief Data type mismatch. 380 */ 381 static constexpr int E_SQLITE_MISMATCH = (E_BASE + 68); 382 383 /** 384 * @brief Library used incorrectly. 385 */ 386 static constexpr int E_SQLITE_MISUSE = (E_BASE + 69); 387 388 /** 389 * @brief Config changed. 390 */ 391 static constexpr int E_CONFIG_INVALID_CHANGE = (E_BASE + 70); 392 393 /** 394 * @brief Not get service. 395 */ 396 static constexpr int E_SERVICE_NOT_FOUND = (E_BASE + 71); 397 398 /** 399 * @brief Database schema has changed. 400 */ 401 static constexpr int E_SQLITE_SCHEMA = (E_BASE + 72); 402 403 /** 404 * @brief Database backup was interrupted. 405 */ 406 static constexpr int E_BACKUP_INTERRUPT = (E_BASE + 0x49); 407 408 /** 409 * @brief Backup interrupt operation is invalid 410 */ 411 static constexpr int E_INVALID_INTERRUPT = (E_BASE + 0x4a); 412 413 /** 414 * @brief Restore is not allowed 415 */ 416 static constexpr int E_DB_RESTORE_NOT_ALLOWED = (E_BASE + 0x4b); 417 418 419 /** 420 * * @brief The secret key is corrupted or lost. 421 */ 422 static constexpr int E_INVALID_SECRET_KEY = (E_BASE + 0x4a); 423 424 /** 425 * @brief Do not use except relational_store 426 */ 427 static constexpr int E_INNER_WARNING = (E_BASE + 0x4c); 428 } // namespace NativeRdb 429 } // namespace OHOS 430 431 #endif 432