| RdbStore | setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void | Sets a list of distributed tables. This method uses a callback to return the result.<br>- **tables**: names of the distributed tables to set.<br>- **callback**: callback invoked to return the result. |
| RdbStore | setDistributedTables(tables: Array\<string>): Promise<void> | Sets a list of distributed tables. This method uses a promise to return the result.<br>- **tables**: names of the distributed tables to set. |
| RdbStore | setDistributedTables(tables: Array\<string>): Promise\<void> | Sets a list of distributed tables. This method uses a promise to return the result.<br>- **tables**: names of the distributed tables to set. |
**Obtaining the Distributed Table Name for a Remote Device**
...
...
@@ -190,6 +190,7 @@ You can obtain the distributed table name for a remote device based on the local
## How to Develop
1. Create an RDB store.
1. Configure the RDB store attributes, including the RDB store name, storage mode, and whether read-only mode is used.
2. Initialize the table structure and related data in the RDB store.
3. Create the RDB store.
...
...
@@ -208,6 +209,7 @@ You can obtain the distributed table name for a remote device based on the local
```
2. Insert data.
1. Create a **ValuesBucket** to store the data you need to insert.
2. Call the **insert()** method to insert data into the RDB store.
...
...
@@ -220,6 +222,7 @@ You can obtain the distributed table name for a remote device based on the local
```
3. Query data.
1. Create an **RdbPredicates** object to specify query conditions.
2. Call the **query()** method to query data.
3. Call the **ResultSet()** method to obtain the query result.
...
...
@@ -242,6 +245,7 @@ You can obtain the distributed table name for a remote device based on the local
```
4. Set the distributed tables to be synchronized.
1. Set the distributed tables.
2. Check whether the setting is successful.
...
...
@@ -257,6 +261,7 @@ You can obtain the distributed table name for a remote device based on the local
```
5. Synchronize data across devices.
1. Constructs an **RdbPredicates** object to specify remote devices within the network to be synchronized.
2. Call the **sync()** method to synchronize data.
3. Check whether the data synchronization is successful.
...
...
@@ -278,6 +283,7 @@ You can obtain the distributed table name for a remote device based on the local
```
6. Subscribe to distributed data.
1. Register an observer to listen for distributed data changes.
2. When data in the RDB store changes, a callback will be invoked to return the data changes.
...
...
@@ -297,6 +303,7 @@ You can obtain the distributed table name for a remote device based on the local
```
7. Query data across devices.
1. Obtain the distributed table name for a remote device based on the local table name.
2. Call the **ResultSet()** method to obtain the query result.