提交 1916222b 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 1d1b6b4d
# Value Bucket
The **ValueBucket** holds data in key-value (KV) pairs. You can use it to insert data into a database.
The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database.
>**Note**
>**NOTE**
>
>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -20,7 +20,7 @@ Enumerates the value types allowed by the database.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
| Name | Description |
| Type | Description |
| ------- | -------------------- |
| number | The value is a number. |
| string | The value is a string.|
......@@ -28,10 +28,10 @@ Enumerates the value types allowed by the database.
## ValuesBucket
Holds a set of KV pairs.
Defines the types of the key and value in a KV pair.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
| Name | Type | Mandatory| Description |
| ------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes | KV pairs in a **ValuesBucket**. The key is of the string type. The value can be a number, string, Boolean value, Unit8Array, or **null**.|
| Key Type | Value Type |
| ------------- | --------------------------------------------- |
| string | [ValueType](#valuetype)\| Uint8Array \| null |
......@@ -789,7 +789,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
| Name | Description |
| Type | Description |
| ------- | -------------------- |
| number | The value is a number. |
| string | The value is a string. |
......
......@@ -681,7 +681,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
| Name | Description |
| Type | Description |
| -------------- | ------------------------------ |
| number | The value is a number. |
| string | The value is a string. |
......
......@@ -781,13 +781,6 @@ Sets the **RdbPredicates** to filter out duplicate records.
```js
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
let promise = rdbStore.query(predicates, ["NAME"])
promise.then((resultSet) => {
console.log("ResultSet column names: " + resultSet.columnNames)
console.log("ResultSet column count: " + resultSet.columnCount)
}).catch((err) => {
console.log("Query err.")
})
```
......@@ -1133,7 +1126,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) {
```
### update<sup>9+</sup>
update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise&lt;number&gt;
update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise&lt;number&gt;
Updates data in the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result.
......@@ -1215,7 +1208,7 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Example**
```js
......@@ -1231,7 +1224,7 @@ promise.then((rows) => {
### delete<sup>9+</sup>
delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void
delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback&lt;number&gt;):void
Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result.
......@@ -1275,7 +1268,7 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Example**
```js
......@@ -1354,7 +1347,7 @@ Queries data in the RDB store based on specified conditions. This API uses a pro
### query<sup>9+</sup>
query(predicates: DataSharePredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void
query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array&lt;string&gt;, callback: AsyncCallback&lt;ResultSet&gt;):void
Queries data in the RDB store based on specified conditions. This API uses an asynchronous callback to return the result.
......@@ -1363,6 +1356,7 @@ Queries data in the RDB store based on specified conditions. This API uses an as
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
| columns | Array&lt;string&gt; | Yes| Columns to query. If this parameter is not specified, the query applies to all columns.|
| callback | AsyncCallback&lt;[ResultSet](js-apis-data-resultset.md)&gt; | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
......@@ -1384,7 +1378,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
### query<sup>9+</sup>
query(predicates: DataSharePredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt;
query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array&lt;string&gt;):Promise&lt;ResultSet&gt;
Queries data in the RDB store based on specified conditions. This API uses a promise to return the result.
......@@ -1393,6 +1387,7 @@ Queries data in the RDB store based on specified conditions. This API uses a pro
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
| columns | Array&lt;string&gt; | No| Columns to query. If this parameter is not specified, the query applies to all columns.|
......@@ -1591,7 +1586,7 @@ rdbStore.commit()
### rollBack<sup>8+</sup>
rollBack():void;
rollBack():void
Rolls back the SQL statements that have been executed.
......@@ -1997,7 +1992,7 @@ Defines the data types allowed.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Description|
| Type| Description|
| -------- | -------- |
| number | Number.|
| string | String.|
......@@ -2006,14 +2001,13 @@ Defines the data types allowed.
## ValuesBucket
Defines a bucket to store key-value pairs.
Defines the types of the key and value in a KV pair.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| [key:&nbsp;string] | [ValueType](#valuetype)\|&nbsp;Uint8Array&nbsp;\|&nbsp;null | Yes| Defines a bucket to store key-value pairs.|
| Key Type| Value Type|
| -------- | -------- |
| string | [ValueType](#valuetype)\|&nbsp;Uint8Array&nbsp;\|&nbsp;null |
## SyncMode<sup>8+</sup>
......
......@@ -793,7 +793,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
| Name | Description |
| Type | Description |
| ------- | -------------------- |
| number | The value is a number. |
| string | The value is a string. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册