DatabaseReadWrite:基于 C-API 的关系型数据库读写示例项目

可用于学习HarmonyOS中使用C-API进行关系型数据库操作,展示商品增删改查及筛选功能,核心为NDK封装RDB数据库与ArkUI界面交互。【此简介由AI生成】

Branch1Tags0
FilesLast commitLast update
2 years ago
5 months ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago

Using C APIs to Read/Write a Relational Store

Overview

This sample shows how to use C APIs to add, delete, modify, and query a relational store.

Preview

Home Page Adding/Editing Offerings Filtering Offerings

How to Use

  1. Tap Add to add an offering. After you tap Submit, the added offering information is displayed on the home page.
  2. Tap the edit icon to modify the information of an offering in the current list. After you tap Submit, the modified offering information is displayed on the home page.
  3. Tap the delete icon to delete an offering from the current list. After the deletion, the remaining offering information is displayed on the home page.
  4. Tap Offering to filter offerings by category. Mate 60/Mate 40 series offerings can be filtered and displayed in the offering list.
  5. Tap Price to filter offerings by price and display them on the home page.
  6. Tap the refresh icon to clear the filters. All offerings are displayed.

How to Implement

This sample consists of the following two parts:

Project Directory

 ├───entry/src/main/ets        
 │   ├───constant       
 │   │   └───FileConstants.ets                      // Encapsulation constants 
 │   ├───entryability 
 │   │   └───EntryAbility.ets                       // Ability lifecycle callbacks 
 │   ├───entrybackupability 
 │   │   └───EntryBackupAbility.ets                 // Backup ability lifecycle callbacks 
 │   ├───model 
 │   │   └───GoodModel.ets                          // Encapsulation offering class 
 │   └───pages 
 │       ├───Index.ets                              // Home page 
 │       └───GoodsList.ets                          // Offering list page 
 ├───entry/src/main/cpp   
 │   ├───types/libentry/Index.d.ts                  // Function and type declarations 
 │   ├───RDB.h									    // Encapsulated RDB 
 │   ├───RDB.cpp									// Encapsulated RDB 
 │   └───napi_init.cpp                              // Custom NDK functions encapsulated to ArkUI. 
 └───entry/src/main/resources                       // Static resources of the app

Permissions

N/A

Dependencies

N/A

Constraints

  1. The sample is only supported on Huawei phones with standard systems.
  2. The HarmonyOS version must be HarmonyOS 5.0.5 Release or later.
  3. The DevEco Studio version must be DevEco Studio 5.0.5 Release or later.
  4. The HarmonyOS SDK version must be HarmonyOS 5.0.5 Release SDK or later.

Introduction

可用于学习HarmonyOS中使用C-API进行关系型数据库操作,展示商品增删改查及筛选功能,核心为NDK封装RDB数据库与ArkUI界面交互。【此简介由AI生成】

Customize your domain