Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3cc8d454
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3cc8d454
编写于
3月 22, 2023
作者:
L
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
devices
Signed-off-by:
N
lihuihui
<
lihuihui29@huawei.com
>
上级
4f66aea0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
13 deletion
+22
-13
zh-cn/application-dev/database/database-relational-guidelines.md
...pplication-dev/database/database-relational-guidelines.md
+9
-8
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
...cation-dev/reference/apis/js-apis-data-relationalStore.md
+13
-5
未找到文件。
zh-cn/application-dev/database/database-relational-guidelines.md
浏览文件 @
3cc8d454
...
...
@@ -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
<
string
>
): Promise
<
ResultSet
>
| 根据指定条件查询数据库中的数据,使用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) 构造用于查询分布式表的谓词对象,指定组网内的远程分布式表名和设备。
...
...
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
浏览文件 @
3cc8d454
...
...
@@ -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
<
string
>
| 是 | 指定的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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录