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