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 /** 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 oh_data_values_buckets.h 30 * 31 * @brief Provides functions and enumerations related to the data value buckets. 32 * 33 * @kit ArkData 34 * @library libnative_rdb_ndk.z.so 35 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 36 * 37 * @since 16 38 */ 39 40 41 #ifndef OH_VALUES_BUCKETS_H 42 #define OH_VALUES_BUCKETS_H 43 #include "oh_values_bucket.h" 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief Define the OH_Data_VBuckets structure type. 50 * 51 * @since 16 52 */ 53 typedef struct OH_Data_VBuckets OH_Data_VBuckets; 54 55 /** 56 * @brief Creates an OH_Data_VBuckets instance object. 57 * 58 * @return Returns a pointer to OH_Data_VBuckets instance when the execution is successful. 59 * Otherwise, nullptr is returned. The memory must be released through the OH_VBuckets_Destroy 60 * interface after the use is complete. 61 * @see OH_VBuckets_Destroy. 62 * @since 16 63 */ 64 OH_Data_VBuckets *OH_VBuckets_Create(void); 65 66 /** 67 * @brief Destroys an OH_Data_VBuckets instance object. 68 * 69 * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. 70 * @return Returns the error code. 71 * Returns {@link RDB_OK} if the execution is successful. 72 * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. 73 * @since 16 74 */ 75 int OH_VBuckets_Destroy(OH_Data_VBuckets *buckets); 76 77 /** 78 * @brief Add an OH_VBucket to OH_Data_VBuckets object. 79 * 80 * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. 81 * @param row Represents a pointer to an instance of OH_VBucket. 82 * @return Returns the error code. 83 * Returns {@link RDB_OK} if the execution is successful. 84 * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. 85 * @since 16 86 */ 87 int OH_VBuckets_PutRow(OH_Data_VBuckets *buckets, const OH_VBucket *row); 88 89 /** 90 * @brief Add an OH_Data_VBuckets to OH_Data_VBuckets object. 91 * 92 * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. 93 * @param rows Represents a pointer to an instance of OH_Data_VBuckets. 94 * @return Returns the error code. 95 * Returns {@link RDB_OK} if the execution is successful. 96 * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. 97 * @since 16 98 */ 99 int OH_VBuckets_PutRows(OH_Data_VBuckets *buckets, const OH_Data_VBuckets *rows); 100 101 /** 102 * @brief Gets the number of rows in OH_Data_VBuckets object. 103 * 104 * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. 105 * @param count Represents the count of OH_VBucket in OH_Data_VBuckets. It is an output parameter. 106 * @return Returns the error code. 107 * Returns {@link RDB_OK} if the execution is successful. 108 * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. 109 * @since 16 110 */ 111 int OH_VBuckets_RowCount(OH_Data_VBuckets *buckets, size_t *count); 112 113 #ifdef __cplusplus 114 }; 115 #endif 116 #endif 117 /** @} */ 118