• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oh_values_bucket.h
2
3## Overview
4
5Defines the types of the key and value in a KV pair.
6
7**File to include**: <database/rdb/oh_values_bucket.h>
8
9**Library**: libnative_rdb_ndk.z.so
10
11**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
12
13**Since**: 10
14
15**Related module**: [RDB](capi-rdb.md)
16
17## Summary
18
19### Structs
20
21| Name                            | typedef Keyword| Description                  |
22| -------------------------------- | ------------- | ---------------------- |
23| [OH_VBucket](capi-rdb-oh-vbucket.md) | OH_VBucket    | Defines a struct for the types of the key and value in a KV pair.|
24
25### Functions
26
27| Name                                                        | Description                                                        |
28| ------------------------------------------------------------ | ------------------------------------------------------------ |
29| [int OH_VBucket_PutAsset(OH_VBucket *bucket, const char *field, Data_Asset *value)](#oh_vbucket_putasset) | Puts a [Data_Asset](capi-rdb-data-asset.md) object into the [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.|
30| [int OH_VBucket_PutAssets(OH_VBucket *bucket, const char *field, Data_Asset **value, uint32_t count)](#oh_vbucket_putassets) | Puts an array of [Data_Asset](capi-rdb-data-asset.md) objects into the [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.|
31| [int OH_VBucket_PutFloatVector(OH_VBucket *bucket, const char *field, const float *vec, size_t len)](#oh_vbucket_putfloatvector) | Puts a float array into an [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.|
32| [int OH_VBucket_PutUnlimitedInt(OH_VBucket *bucket, const char *field, int sign, const uint64_t *trueForm, size_t len)](#oh_vbucket_putunlimitedint) | Puts an integer of any length into an [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.|
33
34## Function Description
35
36### OH_VBucket_PutAsset()
37
38```
39int OH_VBucket_PutAsset(OH_VBucket *bucket, const char *field, Data_Asset *value)
40```
41
42**Description**
43
44Puts a [Data_Asset](capi-rdb-data-asset.md) object into the [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.
45
46**Since**: 11
47
48
49**Parameters**
50
51| Name                                  | Description                                                |
52| ---------------------------------------- | ---------------------------------------------------- |
53| [OH_VBucket](capi-rdb-oh-vbucket.md) *bucket | Pointer to the [OH_VBucket](capi-rdb-oh-vbucket.md) instance.|
54| const char *field                        | Pointer to the column name in the database table.                                  |
55| [Data_Asset](capi-rdb-data-asset.md) *value  | Pointer to the value to put.                        |
56
57**Returns**
58
59| Type| Description                                                        |
60| ---- | ------------------------------------------------------------ |
61| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified.|
62
63### OH_VBucket_PutAssets()
64
65```
66int OH_VBucket_PutAssets(OH_VBucket *bucket, const char *field, Data_Asset **value, uint32_t count)
67```
68
69**Description**
70
71Puts an array of [Data_Asset](capi-rdb-data-asset.md) objects into the [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.
72
73**Since**: 11
74
75
76**Parameters**
77
78| Name                                  | Description                                                        |
79| ---------------------------------------- | ------------------------------------------------------------ |
80| [OH_VBucket](capi-rdb-oh-vbucket.md) *bucket | Pointer to the [OH_VBucket](capi-rdb-oh-vbucket.md) instance.        |
81| const char *field                        | Pointer to the column name in the database table.                                          |
82| [Data_Asset](capi-rdb-data-asset.md) **value | Double pointer to the value to put.                                |
83| uint32_t count                           | Number of elements in the [Data_Asset](capi-rdb-data-asset.md) object to put.|
84
85**Returns**
86
87| Type| Description                                                        |
88| ---- | ------------------------------------------------------------ |
89| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified.|
90
91**See**
92
93OH_VBucket
94
95### OH_VBucket_PutFloatVector()
96
97```
98int OH_VBucket_PutFloatVector(OH_VBucket *bucket, const char *field, const float *vec, size_t len)
99```
100
101**Description**
102
103Puts a float array into an [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.
104
105**Since**: 18
106
107
108**Parameters**
109
110| Name                                  | Description                                                |
111| ---------------------------------------- | ---------------------------------------------------- |
112| [OH_VBucket](capi-rdb-oh-vbucket.md) *bucket | Pointer to the [OH_VBucket](capi-rdb-oh-vbucket.md) instance.|
113| const char *field                        | Pointer to the column name in the database table.                                  |
114| const float *vec                         | Pointer to the float array to put.                           |
115| size_t len                               | Length of the float array to put.                               |
116
117**Returns**
118
119| Type| Description                                                        |
120| ---- | ------------------------------------------------------------ |
121| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified.|
122
123**See**
124
125OH_VBucket
126
127### OH_VBucket_PutUnlimitedInt()
128
129```
130int OH_VBucket_PutUnlimitedInt(OH_VBucket *bucket, const char *field, int sign, const uint64_t *trueForm, size_t len)
131```
132
133**Description**
134
135Puts an integer of any length into an [OH_VBucket](capi-rdb-oh-vbucket.md) object in the given column.
136
137**Since**: 18
138
139
140**Parameters**
141
142| Name                                  | Description                                                  |
143| ---------------------------------------- | ------------------------------------------------------ |
144| [OH_VBucket](capi-rdb-oh-vbucket.md) *bucket | Pointer to the [OH_VBucket](capi-rdb-oh-vbucket.md) instance.  |
145| const char *field                        | Pointer to the column name in the database table.                                    |
146| int sign                                 | Sign notation of the integer object. The value **0** indicates a positive integer, and the value **1** indicates a negative integer.|
147| const uint64_t *trueForm                 | Pointer to the integer object to put.                          |
148| size_t len                               | Length of the integer object to put.                                  |
149
150**Returns**
151
152| Type| Description                                                        |
153| ---- | ------------------------------------------------------------ |
154| int  | Returns **RDB_OK** if the operation is successful; returns an error code otherwise.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified.|
155