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 #ifndef OH_VALUES_BUCKET_H 17 #define OH_VALUES_BUCKET_H 18 19 /** 20 * @addtogroup RDB 21 * @{ 22 * 23 * @brief The relational database (RDB) store manages data based on relational models. 24 * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. 25 * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations 26 * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. 27 * 28 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 29 * @since 10 30 */ 31 32 /** 33 * @file oh_values_bucket.h 34 * 35 * @brief Define the type of stored key value pairs. 36 * 37 * @since 10 38 */ 39 40 #include <cstdint> 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /** 46 * @brief Define the OH_VBucket structure type. 47 * 48 * @since 10 49 */ 50 typedef struct OH_VBucket { 51 /** 52 * The id used to uniquely identify the OH_VBucket struct. 53 */ 54 int64_t id; 55 56 /** 57 * Indicates the capability of OH_VBucket. 58 */ 59 uint16_t capability; 60 61 /** 62 * @brief Put the const char * value to this {@link OH_VBucket} object for the given column name. 63 * 64 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 65 * @param field Indicates the name of the column. 66 * @param value Indicates the const char * value. 67 * @return Returns the status code of the execution. 68 * @see OH_VBucket. 69 * @since 10 70 */ 71 int (*putText)(OH_VBucket *bucket, const char *field, const char *value); 72 73 /** 74 * @brief Put the int64 value to this {@link OH_VBucket} object for the given column name. 75 * 76 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 77 * @param field Indicates the name of the column. 78 * @param value Indicates the int64 value. 79 * @return Returns the status code of the execution. 80 * @see OH_VBucket. 81 * @since 10 82 */ 83 int (*putInt64)(OH_VBucket *bucket, const char *field, int64_t value); 84 85 /** 86 * @brief Put the double value to this {@link OH_VBucket} object for the given column name. 87 * 88 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 89 * @param field Indicates the name of the column. 90 * @param value Indicates the double value. 91 * @return Returns the status code of the execution. 92 * @see OH_VBucket. 93 * @since 10 94 */ 95 int (*putReal)(OH_VBucket *bucket, const char *field, double value); 96 97 /** 98 * @brief Put the const uint8_t * value to this {@link OH_VBucket} object for the given column name. 99 * 100 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 101 * @param field Indicates the name of the column. 102 * @param value Indicates the const uint8_t * value. 103 * @param size Indicates the size of value. 104 * @return Returns the status code of the execution. 105 * @see OH_VBucket. 106 * @since 10 107 */ 108 int (*putBlob)(OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size); 109 110 /** 111 * @brief Put NULL to this {@link OH_VBucket} object for the given column name. 112 * 113 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 114 * @param field Indicates the name of the column. 115 * @return Returns the status code of the execution. 116 * @see OH_VBucket. 117 * @since 10 118 */ 119 int (*putNull)(OH_VBucket *bucket, const char *field); 120 121 /** 122 * @brief Clear the {@link OH_VBucket} object's values. 123 * 124 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 125 * @return Returns the status code of the execution. 126 * @see OH_VBucket. 127 * @since 10 128 */ 129 int (*clear)(OH_VBucket *bucket); 130 131 /** 132 * @brief Destroy the {@link OH_VBucket} object and reclaim the memory occupied by the object. 133 * 134 * @param bucket Represents a pointer to an {@link OH_VBucket} instance. 135 * @return Returns the status code of the execution. 136 * @see OH_VBucket. 137 * @since 10 138 */ 139 int (*destroy)(OH_VBucket *bucket); 140 } OH_VBucket; 141 142 #ifdef __cplusplus 143 }; 144 #endif 145 146 #endif // OH_VALUES_BUCKET_H 147