1 /* 2 * Copyright (c) 2024 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 GRD_TYPE_EXPORT_H 17 #define GRD_TYPE_EXPORT_H 18 #include <cstdint> 19 #ifdef __cplusplus 20 extern "C" { 21 #endif // __cplusplus 22 23 #ifndef _WIN32 24 #define GRD_API __attribute__((visibility("default"))) 25 #else 26 #define GRD_API 27 #endif 28 29 typedef struct GRD_DB GRD_DB; 30 typedef struct GRD_SqlStmt GRD_SqlStmt; 31 32 /** 33 * @brief Open database config 34 */ 35 #define GRD_DB_OPEN_ONLY 0x00 36 #define GRD_DB_OPEN_CREATE 0x01 37 // check data in database if close abnormally last time, if data is corrupted, rebuild the database 38 #define GRD_DB_OPEN_CHECK_FOR_ABNORMAL 0x02 39 // check data in database when open database, if data is corrupted, rebuild the database. 40 #define GRD_DB_OPEN_CHECK 0x04 41 #define GRD_DB_OPEN_SHARED_READ_ONLY 0x08 42 43 /** 44 * @brief Close database config 45 */ 46 #define GRD_DB_CLOSE 0x00 47 #define GRD_DB_CLOSE_IGNORE_ERROR 0x01 48 49 #define GRD_DOC_ID_DISPLAY 0x01 50 typedef enum { 51 GRD_DB_DATATYPE_INTEGER = 0, 52 GRD_DB_DATATYPE_FLOAT, 53 GRD_DB_DATATYPE_TEXT, 54 GRD_DB_DATATYPE_BLOB, 55 GRD_DB_DATATYPE_FLOATVECTOR, 56 GRD_DB_DATATYPE_NULL, 57 } GRD_DbDataTypeE; 58 59 typedef enum { 60 GRD_CONFIG_USER_VERSION, 61 GRD_CONFIG_BOTTOM, 62 } GRD_ConfigTypeE; 63 64 typedef struct GRD_DbValueT { 65 GRD_DbDataTypeE type; 66 union { 67 int64_t longValue; 68 double doubleValue; 69 struct { 70 const void *strAddr; 71 uint32_t length; 72 }; 73 } value; 74 } GRD_DbValueT; 75 76 typedef struct GRD_DB GRD_DB; 77 78 #ifdef __cplusplus 79 } 80 #endif // __cplusplus 81 #endif // GRD_TYPE_EXPORT_H