From d806d5c2309ffe46d3a9b52dd843f049d4bb76b1 Mon Sep 17 00:00:00 2001 From: ltdong Date: Fri, 1 Jul 2022 15:31:54 +0800 Subject: [PATCH 1/2] Add getVersion, setVersion and other interfaces. Signed-off-by: ltdong --- api/@ohos.data.rdb.d.ts | 86 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 71837d5297..274f851817 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -95,6 +95,67 @@ declare namespace rdb { SUBSCRIBE_TYPE_REMOTE = 0, } + /** + * Describes the {@code RdbStore} type. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + enum SecurityLevel { + /** + * NO_LEVEL: mains not set the security level. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + NO_LEVEL = 0, + + /** + * S0: mains the db is public. + * There is no impact even if the data is leaked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + S0 = 1, + + /** + * S1: mains the db is low level security + * There are some low impact, when the data is leaked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + S1 = 2, + + /** + * S2: mains the db is middle level security + * There are some major impact, when the data is leaked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + S2 = 3, + + /** + * S3: mains the db is high level security + * There are some severity impact, when the data is leaked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + S3 = 5, + + /** + * S4: mains the db is critical level security + * There are some critical impact, when the data is leaked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + S4 = 6, + } + /** * Provides methods for managing the relational database (RDB). * @@ -257,6 +318,25 @@ declare namespace rdb { restore(srcName:string, callback: AsyncCallback):void; restore(srcName:string): Promise; + /** + * Set the database version. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param version Indicates the database version for upgrade or downgrade. + */ + setVersion(version: number, callback: AsyncCallback):void; + setVersion(version: number): Promise; + + /** + * Get the current database version. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + getVersion(callback: AsyncCallback):void; + getVersion(): Promise; + /** * Set table to be distributed table. * @@ -348,6 +428,12 @@ declare namespace rdb { */ interface StoreConfig { name: string; + /** + * Indicates setting the database security level + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + securityLevel?: SecurityLevel; } /** -- Gitee From 25a644097d207fccf8e7058aa6ef4c723ada88bb Mon Sep 17 00:00:00 2001 From: ltdong Date: Thu, 21 Jul 2022 10:16:23 +0800 Subject: [PATCH 2/2] Modify the review comments. Signed-off-by: ltdong --- api/@ohos.data.rdb.d.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 274f851817..3395c34eb2 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -102,14 +102,6 @@ declare namespace rdb { * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ enum SecurityLevel { - /** - * NO_LEVEL: mains not set the security level. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - */ - NO_LEVEL = 0, - /** * S0: mains the db is public. * There is no impact even if the data is leaked. @@ -117,7 +109,7 @@ declare namespace rdb { * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ - S0 = 1, + S0, /** * S1: mains the db is low level security @@ -126,7 +118,7 @@ declare namespace rdb { * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ - S1 = 2, + S1, /** * S2: mains the db is middle level security @@ -135,7 +127,7 @@ declare namespace rdb { * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ - S2 = 3, + S2, /** * S3: mains the db is high level security @@ -144,7 +136,7 @@ declare namespace rdb { * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ - S3 = 5, + S3, /** * S4: mains the db is critical level security @@ -153,7 +145,7 @@ declare namespace rdb { * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ - S4 = 6, + S4, } /** @@ -427,6 +419,11 @@ declare namespace rdb { * @import import data_rdb from '@ohos.data.rdb'; */ interface StoreConfig { + /** + * Indicates the database name + * @since 7 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ name: string; /** * Indicates setting the database security level -- Gitee