• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Data Management Development
2
3## How Do I Save PixelMap Data to a Database?
4
5Applicable to: OpenHarmony SDK 3.2.3.5
6
7You can convert a **PixelMap** into an **ArrayBuffer** and save the **ArrayBuffer** to your database.
8
9Reference: [readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1)
10
11## How Do I Obtain RDB Store Files?
12
13Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
14
15Run the hdc_std command to copy the .db, .db-shm, and .db-wal files in **/data/app/el2/100/database/*bundleName*/entry/db/**, and then use the SQLite tool to open the files.
16
17Example:
18
19```
20 hdc_std file recv /data/app/el2/100/database/com.xxxx.xxxx/entry/db/test.db ./test.db
21```
22
23## Does the Database Has a Lock Mechanism?
24
25Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
26
27The distributed data service (DDS), relational database (RDB) store, and preferences provided OpenHarmony have a lock mechanism. You do not need to bother with the lock mechanism during the development.
28
29## What Is a Transaction in an RDB Store?
30
31Applicable to: all versions
32
33When a large number of operations are performed in an RDB store, an unexpected exception may cause a failure of some data operations and loss of certain data. As a result, the application may become abnormal or even crash.
34
35A transaction is a group of tasks serving as a single logical unit. It eliminates the failure of some of the operations and loss of associated data.
36
37## What Data Types Does an RDB Store Support?
38
39Applicable to: OpenHarmony SDK 3.0 or later, stage model of API version 9
40
41An RDB store supports data of the number, string, and Boolean types. The number array supports data of the Double, Long, Float, Int, or Int64 type, with a maximum precision of 17 decimal digits.
42
43## How Do I View Database db Files?
44
45Applicable to: OpenHarmony SDK 3.2.6.5, stage model of API version 9
46
471. Run the **hdc_std shell** command.
48
492. Obtain the absolute path or sandbox path of the database.
50
51The absolute path is **/data/app/el2/<userId>/database/<bundleName>**. The default **<userId>** is **100**.
52
53To obtain the sandbox path, run the **ps -ef | grep hapName** command to obtain the process ID of the application.
54
55The database sandbox path is **/proc/<Application process ID>/root/data/storage/el2/database/**.
56
573. Run the **find ./ -name "\*.db"** command in the absolute path or sandbox path of the database.
58
59## How Do I Store Long Text Data?
60
61Applicable to: OpenHarmony SDK 3.2.5.5, API version 9
62
63- Preferences support a string of up to 8192 bytes.
64
65- The KV store supports a value of up to 4 MB.
66
67Reference: [Preference Overview](../database/database-preference-overview.md) and [Distributed Data Service Overview](../database/database-mdds-overview.md)
68
69## How Do I Develop DataShare on the Stage Model
70
71Applicable to: OpenHarmony SDK 3.2.5.5, API version 9
72
73The DataShare on the stage model cannot be used with the **DataAbility** for the FA model. The connected server application must be implemented by using **DataShareExtensionAbility**.
74
75Reference: [DataShare Development](../database/database-datashare-guidelines.md)
76
77