• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# OH_VBucket
2
3## Overview
4
5Defines a struct for the types of the key and value in a KV pair.
6
7**Since**: 10
8
9**Related module**: [RDB](capi-rdb.md)
10
11**Header file**: [oh_values_bucket.h](capi-oh-values-bucket-h.md)
12
13### Member Variables
14
15| Name               | Description                          |
16| ------------------- | ------------------------------ |
17| int64_t id          | Unique identifier of the **OH_VBucket** struct.|
18| uint16_t capability | Number of the KV pairs in the struct.|
19
20
21### Member Functions
22
23| Name                                                         | Description                                                  |
24| ------------------------------------------------------------ | ------------------------------------------------------------ |
25| [int (*putText)(OH_VBucket *bucket, const char *field, const char *value)](#puttext) | Puts a char * value into the **OH_VBucket** object in the given column. |
26| [int (*putInt64)(OH_VBucket *bucket, const char *field, int64_t value)](#putint64) | Puts an int64_t value into the **OH_VBucket** object in the given column. |
27| [int (*putReal)(OH_VBucket *bucket, const char *field, double value)](#putreal) | Puts a double value into the **OH_VBucket** object in the given column. |
28| [int (*putBlob)(OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size)](#putblob) | Puts a const uint8_t * value into the **OH_VBucket** object in the given column. |
29| [int (*putNull)(OH_VBucket *bucket, const char *field)](#putnull) | Puts a null value into the **OH_VBucket** object in the given column. |
30| [int (*clear)(OH_VBucket *bucket)](#clear)                   | Clears an **OH_VBucket** object.                             |
31| [int (*destroy)(OH_VBucket *bucket)](#destroy)               | Destroys an **OH_VBucket** object and reclaims the memory occupied. |
32
33
34### Member Function Description
35
36### putText()
37
38```
39int (*putText)(OH_VBucket *bucket, const char *field, const char *value)
40```
41
42**Description**
43
44Puts a char value into the **OH_VBucket** object in the given column.
45
46**Since**: 10
47
48**Parameters**
49
50| Name            | Description                          |
51| ------------------ | ------------------------------ |
52| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
53| const char *field  | Pointer to the column name in the database table.              |
54| const char *value  | Pointer to the value to put.  |
55
56**Returns**
57
58| Type| Description                                      |
59| ---- | ------------------------------------------ |
60| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
61
62### putInt64()
63
64```
65int (*putInt64)(OH_VBucket *bucket, const char *field, int64_t value)
66```
67
68**Description**
69
70Puts an int64_t value into the **OH_VBucket** object in the given column.
71
72**Since**: 10
73
74**Parameters**
75
76| Name            | Description                          |
77| ------------------ | ------------------------------ |
78| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
79| const char *field  | Pointer to the column name in the database table.              |
80| const char *value  | Pointer to the value to put.  |
81
82**Returns**
83
84| Type| Description                                      |
85| ---- | ------------------------------------------ |
86| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
87
88### putReal()
89
90```
91int (*putReal)(OH_VBucket *bucket, const char *field, double value)
92```
93
94**Description**
95
96Puts a double value into the **OH_VBucket** object in the given column.
97
98**Since**: 10
99
100**Parameters**
101
102| Name            | Description                          |
103| ------------------ | ------------------------------ |
104| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
105| const char *field  | Pointer to the column name in the database table.              |
106| double value       | Pointer to the value to put.  |
107
108**Returns**
109
110| Type| Description                                      |
111| ---- | ------------------------------------------ |
112| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
113
114### putBlob()
115
116```
117int (*putBlob)(OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size)
118```
119
120**Description**
121
122Puts a const uint8_t * value into the **OH_VBucket** object in the given column.
123
124**Since**: 10
125
126**Parameters**
127
128| Name            | Description                          |
129| ------------------ | ------------------------------ |
130| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
131| const char *field  | Pointer to the column name in the database table.              |
132| const char *value  | Pointer to the value to put.  |
133| uint32_t size      | Value length.             |
134
135**Returns**
136
137| Type| Description                                      |
138| ---- | ------------------------------------------ |
139| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
140
141### putNull()
142
143```
144int (*putNull)(OH_VBucket *bucket, const char *field)
145```
146
147**Description**
148
149Puts a null value into the **OH_VBucket** object in the given column.
150
151**Since**: 10
152
153**Parameters**
154
155| Name            | Description                          |
156| ------------------ | ------------------------------ |
157| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
158| const char *field  | Pointer to the column name in the database table.              |
159
160**Returns**
161
162| Type| Description                                      |
163| ---- | ------------------------------------------ |
164| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
165
166### clear()
167
168```
169int (*clear)(OH_VBucket *bucket)
170```
171
172**Description**
173
174Puts a char * value into the **OH_VBucket** object in the given column.
175
176**Since**: 10
177
178**Parameters**
179
180| Name            | Description                          |
181| ------------------ | ------------------------------ |
182| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
183
184**Returns**
185
186| Type| Description                                      |
187| ---- | ------------------------------------------ |
188| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
189
190### destroy()
191
192```
193int (*destroy)(OH_VBucket *bucket)
194```
195
196**Description**
197
198Puts a char value into the **OH_VBucket** object in the given column.
199
200**Since**: 10
201
202**Parameters**
203
204| Name            | Description                          |
205| ------------------ | ------------------------------ |
206| OH_VBucket *bucket | Pointer to the **OH_VBucket** instance.|
207
208**Returns**
209
210| Type| Description                                      |
211| ---- | ------------------------------------------ |
212| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.|
213