未验证 提交 acd93659 编写于 作者: 葛亚芳 提交者: Gitee

update en/application-dev/database/database-mdds-guidelines.md.

Signed-off-by: N@ge-yafang <geyafang@huawei.com>
上级 fc869426
......@@ -77,7 +77,7 @@ The following uses a single KV store as an example to describe the development p
1. Import the distributed database module.
```
```js
import distributedData from '@ohos.data.distributedData';
```
......@@ -88,7 +88,7 @@ The following uses a single KV store as an example to describe the development p
The sample code is as follows:
```
```js
let kvManager;
try {
const kvManagerConfig = {
......@@ -118,7 +118,7 @@ The following uses a single KV store as an example to describe the development p
The sample code is as follows:
```
```js
let kvStore;
try {
const options = {
......@@ -149,7 +149,7 @@ The following uses a single KV store as an example to describe the development p
The following is the sample code for subscribing to the data changes of a single KV store:
```
```js
kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) {
console.log("dataChange callback call data: " + JSON.stringify(data));
});
......@@ -162,7 +162,7 @@ The following uses a single KV store as an example to describe the development p
The following is the sample code for writing key-value pairs of the string type into the single KV store:
```
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try {
......@@ -185,7 +185,7 @@ The following uses a single KV store as an example to describe the development p
The following is the sample code for querying data of the string type from the single KV store:
```
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try {
......@@ -210,7 +210,7 @@ The following uses a single KV store as an example to describe the development p
The following is the sample code for data synchronization in a single KV store. **deviceIds** can be obtained by deviceManager by calling **getTrustedDeviceListSync\(\)**, and **1000** indicates that the maximum delay time is 1000 ms.
```
```js
import deviceManager from '@ohos.distributedHardware.deviceManager';
let devManager;
......@@ -231,5 +231,3 @@ The following uses a single KV store as an example to describe the development p
}
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册