diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h index 007d13aae0180cabb81889dc380344b270185500..16b5eb4b94ffded7618f1aa4cc47e060c5cd8338 100644 --- a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_error.h @@ -22,32 +22,64 @@ extern "C" { #endif // __cplusplus +// Error category #define GRD_OK 0 +// Error category #define GRD_NOT_SUPPORT (-1000) #define GRD_OVER_LIMIT (-2000) #define GRD_INVALID_ARGS (-3000) #define GRD_SYSTEM_ERR (-4000) +#define GRD_FAILED_FILE_FORMAT (-5000) +#define GRD_INVALID_FILE_FORMAT (-6000) #define GRD_INNER_ERR (-8000) #define GRD_RESOURCE_BUSY (-9000) #define GRD_NO_DATA (-11000) #define GRD_FAILED_MEMORY_ALLOCATE (-13000) #define GRD_FAILED_MEMORY_RELEASE (-14000) +#define GRD_DATA_CONFLICT (-16000) +#define GRD_NOT_AVAILABLE (-19000) #define GRD_INVALID_FORMAT (-37000) +#define GRD_REBUILD_DATABASE (-38000) -#define GRD_FIELD_NOT_FOUND (-5003002) -#define GRD_FIELD_TYPE_NOT_MATCH (-5003003) -#define GRD_LARGE_JSON_NEST (-5003004) +// not support +#define GRD_JSON_OPERATION_NOT_SUPPORT (-5001001) -#define GRD_UNVAILABLE_JSON_LIB (-5004001) +// Exceed limit +#define GRD_JSON_LEN_LIMIT (-5002001) +// Invalid parameter +#define GRD_FIELD_TYPE_NOT_MATCH (-5003001) +#define GRD_LARGE_JSON_NEST (-5003002) +#define GRD_INVALID_JSON_TYPE (-5003003) +#define GRD_INVALID_CONFIG_VALUE (-5003004) +#define GRD_INVALID_OPERATOR (-5003005) +#define GRD_INVALID_PROJECTION_FIELD (-5003006) +#define GRD_INVALID_PROJECTION_VALUE (-5003007) +#define GRD_ARRAY_INDEX_NOT_FOUND (-5003008) +// System err +#define GRD_JSON_LIB_HANDLE_FAILED (-5004001) + +// no data #define GRD_COLLECTION_NOT_FOUND (-5011001) #define GRD_RECORD_NOT_FOUND (-5011002) +#define GRD_DB_NOT_FOUND (-11003) +#define GRD_FIELD_NOT_FOUND (-5011004) -#define GRD_INVALID_JSON_FORMAT (-5037001) +// data conflicted +#define GRD_COLLECTION_CONFLICT (-5016001) +#define GRD_KEY_CONFLICT (-5016002) +#define GRD_FIELD_TYPE_CONFLICT (-5016003) +// Cursor or ResultSet not available +#define GRD_RESULT_SET_NOT_AVAILABLE (-5019001) + +// Invalid format +#define GRD_INVALID_JSON_FORMAT (-5037001) +#define GRD_INVALID_KEY_FORMAT (-5037002) +#define GRD_INVALID_COLLECTION_NAME (-5037003) #ifdef __cplusplus } #endif // __cplusplus diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h index 352d2162b9916b154b8a1d038ac0a03e7c735490..0b8ad2c98f6237379a8e5056af5bdddcd7840792 100644 --- a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_base/grd_type_export.h @@ -27,15 +27,22 @@ typedef struct GRD_DB GRD_DB; */ #define GRD_DB_OPEN_ONLY 0x00 #define GRD_DB_OPEN_CREATE 0x01 - +#define GRD_DB_OPEN_CHECK_FOR_ABNORMAL 0x02 //check data in database if close abnormally last time, + //if data is corrupted, rebuild the database +#define GRD_DB_OPEN_CREATE 0x04//check data in database when open database, if data is corrupted, rebuild the database. /** * @brief Close database config */ #define GRD_DB_CLOSE 0x00 #define GRD_DB_CLOSE_IGNORE_ERROR 0x01 -#define GRD_DB_ID_DISPLAY 0x01 +/** + * @brief flush database config +*/ +#define GRD_DB_FLUSH_ASYNC 0x00 +#define GRD_DB_FLUSH_SYNC 0x01 +#define GRD_DOC_ID_DISPLAY 0x01 typedef struct Query { const char *filter; const char *projection; @@ -44,8 +51,11 @@ typedef struct Query { /** * @brief Flags for create and drop collection */ -#define FLAG_CHECK_UDEFINED_DUPLICAte_TABLE 1 +#define IGNORE_EXIST_TABLE 1 +#define IGNORE_NOT_EXIST_TABLE 1 +#define IGNORE_DOC_APPEND 0 +#define IGNORE_DOC_REPLACE 1 #ifdef __cplusplus } #endif // __cplusplus diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h index fc062be4497d52feca315a8142c6a48c157b72ac..96ad01e3b0a7f4bac02fa77e3861bf317d6489eb 100644 --- a/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_Simple/include/grd_document/grd_document_api.h @@ -37,6 +37,8 @@ int GRD_UpSertDoc(GRD_DB *db, const char *collectionName, const char *filter, co int GRD_DeleteDoc(GRD_DB *db, const char *collectionName, const char *filter, unsigned int flags); +int GRD_Flush(GRD_DB *db, unsigned int flags); + #ifdef __cplusplus } #endif