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 19 namespace OHOS { 20 namespace NativeRdb { 21 22 /** 23 * @brief The error code in the correct case. 24 */ 25 constexpr int E_OK = 0; 26 27 /** 28 * @brief The base code of the exception error code. 29 */ 30 constexpr int E_BASE = 14800000; 31 32 /** 33 * @brief The error when the capability not supported. 34 */ 35 constexpr int E_NOT_SUPPORTED = 801; 36 37 /** 38 * @brief The error code for common exceptions. 39 */ 40 constexpr int E_ERROR = E_BASE; 41 42 /** 43 * @brief The error code for common invalid args. 44 */ 45 constexpr int E_INVALID_ARGS = (E_BASE + 1); 46 47 /** 48 * @brief The error code for upgrade the read-only store. 49 */ 50 constexpr int E_CANNOT_UPDATE_READONLY = (E_BASE + 2); 51 52 /** 53 * @brief The error code when deleting a file fails. 54 */ 55 constexpr int E_REMOVE_FILE = (E_BASE + 3); 56 57 /** 58 * @brief The error code when deleting a file fails for rdb store in using. 59 */ 60 constexpr int E_RDB_STORE_IN_USING = (E_BASE + 4); 61 62 /** 63 * @brief The error code for a table name is empty. 64 */ 65 constexpr int E_EMPTY_TABLE_NAME = (E_BASE + 5); 66 67 /** 68 * @brief The error code for a values bucket is empty. 69 */ 70 constexpr int E_EMPTY_VALUES_BUCKET = (E_BASE + 6); 71 72 /** 73 * @brief The error code when the sql is not select. 74 */ 75 constexpr int E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7); 76 77 /** 78 * @brief The error code for the column index is invalid. 79 */ 80 constexpr int E_INVALID_COLUMN_INDEX = (E_BASE + 8); 81 82 /** 83 * @brief The error code for the column type is invalid. 84 */ 85 constexpr int E_INVALID_COLUMN_TYPE = (E_BASE + 9); 86 87 /** 88 * @brief The error code for a file name is empty. 89 */ 90 constexpr int E_EMPTY_FILE_NAME = (E_BASE + 10); 91 92 /** 93 * @brief The error for the current file path is invalid. 94 */ 95 constexpr int E_INVALID_FILE_PATH = (E_BASE + 11); 96 97 /** 98 * @brief The error code when using transactions. 99 */ 100 constexpr int E_TRANSACTION_IN_EXECUTE = (E_BASE + 12); 101 102 /** 103 * @brief The error code for the current status is invalid. 104 */ 105 constexpr int E_INVALID_STATEMENT = (E_BASE + 13); 106 107 /** 108 * @brief The error code when execute write operation in read connection. 109 */ 110 constexpr int E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14); 111 112 /** 113 * @brief The error code for execute begin transaction operation in read connection. 114 */ 115 constexpr int E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15); 116 117 /** 118 * @brief The error code for there are no transactions in this connection. 119 */ 120 constexpr int E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16); 121 122 /** 123 * @brief The error code when begin more step query in one session. 124 */ 125 constexpr int E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17); 126 127 /** 128 * @brief The error code when the current statement doesn't contains one row result data. 129 */ 130 constexpr int E_NO_ROW_IN_QUERY = (E_BASE + 18); 131 132 /** 133 * @brief The error code for the bind arguments count is invalid. 134 */ 135 constexpr int E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19); 136 137 /** 138 * @brief The error code for the object type is invalid. 139 */ 140 constexpr int E_INVALID_OBJECT_TYPE = (E_BASE + 20); 141 142 /** 143 * @brief The error code for the conflict flag is invalid. 144 */ 145 constexpr int E_INVALID_CONFLICT_FLAG = (E_BASE + 21); 146 147 /** 148 * @brief The error code for having clause not in group. 149 */ 150 constexpr int E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22); 151 152 /** 153 * @brief The error code for not supported by step result set. 154 */ 155 constexpr int E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23); 156 157 /** 158 * @brief The error code for step result current tid not equal to object's tid. 159 */ 160 constexpr int E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24); 161 162 /** 163 * @brief The error code when the result query was not executed. 164 */ 165 constexpr int E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25); 166 167 /** 168 * @brief The error code for the result set cursor is after the last row. 169 */ 170 constexpr int E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26); 171 172 /** 173 * @brief The error code for the result set query exceeded. 174 */ 175 constexpr int E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27); 176 177 /** 178 * @brief The error code for the statement not prepared. 179 */ 180 constexpr int E_STATEMENT_NOT_PREPARED = (E_BASE + 28); 181 182 /** 183 * @brief The error code for the result set is incorrect. 184 */ 185 constexpr int E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29); 186 187 /** 188 * @brief The error code when the result set is closed. 189 */ 190 constexpr int E_STEP_RESULT_CLOSED = (E_BASE + 30); 191 192 /** 193 * @brief The error code when input relative path. 194 */ 195 constexpr int E_RELATIVE_PATH = (E_BASE + 31); 196 197 /** 198 * @brief The error code for the new encrypt key is empty. 199 */ 200 constexpr int E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32); 201 202 /** 203 * @brief The error code for change unencrypted to encrypted. 204 */ 205 constexpr int E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33); 206 207 /** 208 * @brief The error code for change encrypt in busy. 209 */ 210 constexpr int E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34); 211 212 /** 213 * @brief The error code when the statement not initialized. 214 */ 215 constexpr int E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35); 216 217 /** 218 * @brief The error code for the attach is not supported in WAL journal mode. 219 */ 220 constexpr int E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36); 221 222 /** 223 * @brief The error code when create folder failed. 224 */ 225 constexpr int E_CREATE_FOLDER_FAIL = (E_BASE + 37); 226 227 /** 228 * @brief The error for SQL builder normalize failed. 229 */ 230 constexpr int E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38); 231 232 /** 233 * @brief The error for store session not give connection temporarily. 234 */ 235 constexpr int E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39); 236 237 /** 238 * @brief The error for store session not current transaction. 239 */ 240 constexpr int E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40); 241 242 /** 243 * @brief The error for not supported the current operation. 244 */ 245 constexpr int E_NOT_SUPPORT = (E_BASE + 41); 246 247 /** 248 * @brief The error for the current parcel is invalid. 249 */ 250 constexpr int E_INVALID_PARCEL = (E_BASE + 42); 251 252 /** 253 * @brief The error code when using sqlite3_step function failed. 254 */ 255 constexpr int E_QUERY_IN_EXECUTE = (E_BASE + 43); 256 257 /** 258 * @brief The error for set persist WAL. 259 */ 260 constexpr int E_SET_PERSIST_WAL = (E_BASE + 44); 261 262 /** 263 * @brief The error when the database does not exist. 264 */ 265 constexpr int E_DB_NOT_EXIST = (E_BASE + 45); 266 267 /** 268 * @brief The error when the read connection count is overload. 269 */ 270 constexpr int E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46); 271 272 /** 273 * @brief The error when the wal file size over default limit. 274 */ 275 static constexpr int E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47); 276 277 /** 278 * @brief The error when the connection count is used up. 279 */ 280 static constexpr int E_CON_OVER_LIMIT = (E_BASE + 48); 281 282 /** 283 * @brief The error when the sharedblock unit is null. 284 */ 285 static constexpr int E_NULL_OBJECT = (E_BASE + 49); 286 287 /** 288 * @brief Failed to get DataObsMgrClient. 289 */ 290 static constexpr int E_GET_DATAOBSMGRCLIENT_FAIL = (E_BASE + 50); 291 292 /** 293 * @brief The error when the type of the distributed table does not match. 294 */ 295 static constexpr int E_TYPE_MISMATCH = (E_BASE + 51); 296 297 /** 298 * @brief The error when database or disk is full. 299 */ 300 static constexpr int E_DATABASE_FULL = (E_BASE + 52); 301 } // namespace NativeRdb 302 } // namespace OHOS 303 304 #endif 305