• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Data Management Development
2
3
4## How do I encrypt an RDB store?
5
6Applicable to: OpenHarmony 3.1 Beta 5 (API version 9)
7
8**Solution**
9
10To encrypt an RDB store, set **encrypt** in **StoreConfig** to **true** when creating the RDB store.
11
12**Reference**
13
14[RDB Store](../reference/apis/js-apis-data-relationalStore.md#storeconfig)
15
16## What if I failed to clear a table in an RDB store using TRUNCATE TABLE?
17
18Applicable to: OpenHarmony SDK 3.2.9.2 (API version 9)
19
20**Symptom**
21
22An error is reported when the **TRUNCATE TABLE** statement is used to clear table data.
23
24**Solution**
25
26The RDB store uses SQLite and does not support the **TRUNCATE TABLE** statement. To clear a table in an RDB store, use the **DELETE** statement, for example, **DELETE FROM sqlite\_sequence WHERE name = 'table\_name'**.
27
28
29
30## What data types does an RDB store support?
31
32Applicable to: OpenHarmony SDK 3.0 or later, API version 9 stage model
33
34**Solution**
35
36An RDB store supports data of the number, string, and Boolean types. The number type supports data of the Double, Long, Float, Int, or Int64 type, with a maximum precision of 17 decimal digits.
37
38## How do I save pixel map data to a database?
39
40Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
41
42**Symptom**
43
44Pixel map data fails to be stored.
45
46**Solution**
47
48Convert the pixel map data into an **ArrayBuffer** and save the **ArrayBuffer** to your database.
49
50**Reference**
51
52[readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1)
53
54## How do I obtain RDB store files?
55
56Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
57
58**Solution**
59
60The RDB store files are stored in **/data/app/el2/100/database/*Bundle_name*/entry/rdb/**. You can use the hdc command to copy the file from the directory and use a SQLite tool to open the file.
61
62Example:
63
64```
65 hdc file recv /data/app/el2/100/database/<bundleName>/entry/db/<tableName>  ./<path>
66```
67
68## Do the OpenHarmony databases have a lock mechanism?
69
70Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
71
72**Solution**
73
74The distributed data service (DDS), RDB store, and preferences provided OpenHarmony have a lock mechanism. You do not need to bother with the lock mechanism during the development.
75
76## What if I failed to use get() to obtain the data saved by @ohos.data.storage put()?
77
78Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
79
80**Symptom**
81
82After @ohos.data.storage **put()** is called to save data, **get()** is called to obtain the data. However, the data fails to be obtained.
83
84**Solution**
85
86The **put()** method provided by **@ohos.data.storage** saves data in the memory. When the application exits, the data in the memory will be cleared. If you want to persist the data, you need to call **flush()** or **flushSync()** after **put()**. After data is persisted, you can use **get()** to obtain the data after the application is restarted.
87
88
89## What if a large text file fails to be saved in an RDB store?
90
91Applicable to: OpenHarmony 3.2 Beta 5 (API version 9)
92
93**Symptom**
94
95In API version 8, large text files cannot be saved in RDB stores.
96
97**Solution**
98
99In versions earlier than API version 9, the maximum length of a text file is 1024 bytes. If the text file exceeds 1024 bytes, it cannot be saved.
100
101The limit on the text file size has been removed since API9 version.
102