• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3633

entry/12-May-2024-2,6742,471

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024143 1211

README.mdD12-May-20241.3 KiB2613

README_zh.mdD12-May-20242.1 KiB3524

build-profile.json5D12-May-20241 KiB4341

hvigorfile.tsD12-May-2024158 21

package.jsonD12-May-2024378 1918

README.md

1# Data Management - Distributed Relational Database
2
3### Introduction
4
5This sample shows how to add, delete, modify, query, and synchronize data in the distributed relational database with extended TypeScript (eTS).
6
7### Usage
8
91. After starting the app, touch **+** to add a contact.
10
112. Touch a contact. On the edit page displayed, you can modify the contact information.
12
133. Touch and hold a contact. The **Select All**, **Cancel**, **Delete**, and **Quit** buttons are displayed at the bottom of the screen. You can touch **Quit** to quit the current page.
14
154. Touch the **More** button in the upper right corner, touch **Connect device**, and select the device with data to be synchronized. After the connection is set up, data is synchronized to the connected device.
16
175. Touch the **More** button in the upper right corner and touch **Settings**. On the page displayed, you can set the data synchronization mode, which can be **Automatic synchronization** or **Manual synchronization**.
18
19### Constraints
20
21- Two networked devices are required to test the data synchronization function.
22
23- This sample can run only on standard-system devices, and API version 8 or later are supported.
24
25- This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
26

README_zh.md

1# 分布式关系型数据库
2
3### 介绍
4
5本示例展示了在eTS中分布式关系型数据库的使用,在增、删、改、查的基本操作外,还包括分布式数据库的数据同步同能。
6
7使用说明:
81. 启动应用后点击“**+**”按钮可以添加联系人。
92. 点击联系人可以进入编辑界面编辑联系人信息。
103. 长按联系人进入多选状态,底部有“**全选**”、“**取消**”、“**删除**”、“**退出**”按钮,点击退出可以退出多选状态。
114. 点击右上角更多按钮,点击“**连接设备**”,选择要同步数据的设备,连接成功后可以开始将本端数据同步到对端。
125. 点击右上角更多按钮,点击“**设置**”可以进入设置界面设置数据同步方式,包括自动同步和手动同步。
13
14### 效果预览
15
16|首页|
17|----------|
18|![home](screenshots/devices/home.png)|
19
20### 相关概念
21
22关系型数据库:获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,包括增、删、改、查。
23分布式关系型数据库:通过rdb的sync接口实现数据同步,通过 on('dataChange')方法实现监听数据变更从而读取对端设备上的数据。
24
25### 相关权限
26
27允许不同设备间的数据交换:[ohos.permission.DISTRIBUTED_DATASYNC](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md#ohospermissiondistributed_datasync)
28
29### 约束与限制
30
311. 本示例的同步功能需要两台设备组网后测试;
322. 本示例仅支持标准系统上运行;
333. 本示例仅支持API9版本SDK,版本号:3.2.9.2;
344. 本示例需要使用DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100, built on November 3, 2022)才可编译运行;
355. 本示例需要使用@ohos.distributedHardware.deviceManager系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)