• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-2,5142,269

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.3 KiB2613

README_zh.mdD12-May-20241.9 KiB3820

build-profile.json5D12-May-20241 KiB4341

hvigorfile.jsD12-May-2024174 21

package.jsonD12-May-2024300 1515

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![home](screenshots/devices/home.png)
8
9### 相关概念
10
11关系型数据库:获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,包括增、删、改、查。
12分布式关系型数据库:通过rdb的sync接口实现数据同步,通过 on('dataChange')方法实现监听数据变更从而读取对端设备上的数据。
13
14### 相关权限
15
16允许不同设备间的数据交换:ohos.permission.DISTRIBUTED_DATASYNC
17
18### 使用说明
19
201.启动应用后点击“**+**”按钮可以添加联系人。
21
222.点击联系人可以进入编辑界面编辑联系人信息。
23
243.长按联系人进入多选状态,底部有“**全选**”、“**取消**”、“**删除**”、“**退出**”按钮,点击退出可以退出多选状态。
25
264.点击右上角更多按钮,点击“**连接设备**”,选择要同步数据的设备,连接成功后可以开始将本端数据同步到对端。
27
285.点击右上角更多按钮,点击“**设置**”可以进入设置界面设置数据同步方式,包括自动同步和手动同步。
29
30### 约束与限制
31
321.本示例的同步功能需要两台设备组网后测试。
33
342.本示例仅支持标准系统上运行。
35
363.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
37
384.本示例需要使用@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)