The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the OpenHarmony RDB provides a complete mechanism for managing local databases.
The preferences database provides lightweight key-value operations for local applications to store a small amount of data. As the stored data is already loaded in the memory, the faster data access speed achieves a higher work efficiency. The preferences database is non-relational, and therefore it is not suitable for storing a large amount of data. Instead, the preferences database is usually used to operate data in key-value pairs.
With the SQLite database as the persistence engine, the OpenHarmony RDB supports all features of the SQLite database , including but not limited to transactions, indices, views, triggers, foreign keys, parameterized queries, and prepared SQL statements.
Figure 2 How the preferences database works
//foundation/distributeddatamgr/appdatamgr
├── frameworks # Framework code
│ └── js # JS API implementation
│ │ └── napi # napi implementation
│ └── native # Internal API implementation
└── interfaces # APIs
└── inner_api # Internal APIs
└── native # C/C++ APIs
Some basic concepts are as follows:
Relational database (RDB)
A database created on the basis of relational models. The RDB stores data in rows and columns.
Result set
A set of query results used to access the data. You can access the required data in a result set in flexible modes.
SQLite database
A lightweight RDB in compliance with the atomicity, consistency, isolation, and durability (ACID) properties. It is an open-source database.
The RDB can use a maximum of four connection pools to manage read and write operations.
To ensure data accuracy, the RDB supports only one writ operation at a time.
Some basic concepts are as follows:
Key-value database
A database that stores data in key-value pairs. The key indicates keyword, and value indicates the corresponding value.
Non-relational database
A database not in compliance with the atomicity, consistency, isolation, and durability (ACID) database management properties of relational data transactions. Instead, the data in a non-relational database is independent and scalable.
Preference data
A type of data that is frequently accessed and used.
A key should be a string with a maximum of 80 characters and cannot be an empty string.
A value in the format of string can have a maximum of 8192 characters. A value can be an empty string.
To avoid a high memory cost, it is recommended that the preferences database store no more than ten thousand data entries.
distributeddatamgr_appdatamgr
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.