@@ -30,7 +30,7 @@ The preference persistent file of an application is stored in the application sa
The following table lists the APIs used for preferences data persistence. Most of the APIs are executed asynchronously, using a callback or promise to return the result. The following table uses the callback-based APIs as an example. For more information about the APIs, see [User Preferences](../reference/apis/js-apis-data-preferences.md).
| put(key: string, value: ValueType, callback: AsyncCallback<void>): void | Writes data to the Preferences instance. You can use **flush()** to persist the **Preferences** instance data.|
...
...
@@ -143,7 +143,9 @@ The following table lists the APIs used for preferences data persistence. Most o
4. Read data.
Use **get()** to obtain the value of the specified key. If the value is null or is not of the default value type, the default data is returned. Example:
Use **get()** to obtain the value of the specified key. If the value is null or is not of the default value type, the default data is returned.
Example:
```js
try{
...
...
@@ -159,7 +161,7 @@ The following table lists the APIs used for preferences data persistence. Most o
@@ -118,7 +118,9 @@ The following table lists the APIs used for RDB data persistence. Most of the AP
>
> - When an application calls **getRdbStore()** to obtain an RDB store instance for the first time, the corresponding database file is generated in the application sandbox. If you want to move the files of an RDB store to another place for view, you must also move the temporary files with finename extensions **-wal** or **-shm** in the same directory. Once an application is uninstalled, the database files and temporary files generated by the application on the device are also removed.
2. Use **insert()** to insert data to the RDB store. Example:
2. Use **insert()** to insert data to the RDB store.
Example:
```js
constvalueBucket={
...
...
@@ -133,16 +135,18 @@ The following table lists the APIs used for RDB data persistence. Most of the AP
return;
}
console.info(`Succeeded in inserting data. rowId:${rowId}`);
})
})
```
> **NOTE**
>
>
> **RelationalStore** does not provide explicit flush operations for data persistence. Data inserted by **insert()** is stored in files persistently.
3. Modify or delete data based on the specified **Predicates** instance.
Use **update()** to modify data and **delete()** to delete data. Example:
Use **update()** to modify data and **delete()** to delete data.
Example:
```js
// Modify data.
...
...
@@ -176,7 +180,9 @@ The following table lists the APIs used for RDB data persistence. Most of the AP
4. Query data based on the conditions specified by **Predicates**.
Use **query()** to query data. The data obtained is returned in a **ResultSet** object. Example:
Use **query()** to query data. The data obtained is returned in a **ResultSet** object.
@@ -91,7 +91,7 @@ The following table lists the APIs for cross-device data synchronization of the
## How to Develop
The following uses a single KV store as an example to describe how to implement cross-device data synchronization. The following describes the development process.
The following uses a single KV store as an example to describe how to implement cross-device data synchronization. The development process is as follows.