diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md index d0be8af0aa1d82af02f8c21e6ab0113d5fe4e350..b335953d1afe2412edd6b7eefb086293dbf1b47b 100644 --- a/en/application-dev/database/database-mdds-guidelines.md +++ b/en/application-dev/database/database-mdds-guidelines.md @@ -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); ``` - -