提交 3cc8d454 编写于 作者: L lihuihui

devices

Signed-off-by: Nlihuihui <lihuihui29@huawei.com>
上级 4f66aea0
......@@ -63,9 +63,10 @@
- 直接调用查询接口。使用该接口,会将包含查询条件的谓词自动拼接成完整的SQL语句进行查询操作,无需用户传入原生的SQL语句。
- 执行原生的SQL语句进行查询操作。
- remoteQuery中的device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**表5** 数据库查询API
| 类名 | 接口名 | 描述 |
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| RdbStore | query(predicates: RdbPredicates, columns?: Array&lt;string&gt;): Promise&lt;ResultSet&gt; | 根据指定条件查询数据库中的数据,使用Promise异步回调。<br/>-predicates:表示RdbPredicates的实例对象指定的查询条件。<br/>-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
......@@ -132,9 +133,9 @@
**表9** 根据本地表名获取指定远程设备的分布式表名
| 类名 | 接口名 | 描述 |
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| RdbStore | obtainDistributedTableName(device: string, table: string): Promise\<string> | 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。<br/>-device:远程设备。<br/>-table:本地表名。 |
| 类名 | 接口名 | 描述 |
| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| RdbStore | obtainDistributedTableName(device: string, table: string): Promise\<string> | 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。<br/>-device:远程设备。<br/>-table:远程设备的本地表名。 |
**在设备之间同步数据**
......@@ -423,7 +424,7 @@
```js
import deviceManager from '@ohos.distributedHardware.deviceManager'
let deviceIds = [];
deviceManager.createDeviceManager('bundleName', (err, value) => {
if (!err) {
......@@ -440,8 +441,8 @@
let tableName = store.obtainDistributedTableName(deviceIds[0], "test");
let resultSet = store.querySql("SELECT * FROM " + tableName);
```
```
8. 远程查询。
(1) 构造用于查询分布式表的谓词对象,指定组网内的远程分布式表名和设备。
......
......@@ -2010,6 +2010,10 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2045,6 +2049,10 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
> **说明:**
>
> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2499,7 +2507,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
| device | string | 是 | 远程设备 。 |
| table | string | 是 | 本地表名。 |
| table | string | 是 | 远程设备的本地表名。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 |
**示例:**
......@@ -2526,10 +2534,10 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- |
| device | string | 是 | 远程设备。 |
| table | string | 是 | 本地表名。 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------------- |
| device | string | 是 | 远程设备。 |
| table | string | 是 | 远程设备的本地表名。 |
**返回值**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册