From 674b4c8d2899b31e53638254a22df45cd5b612d4 Mon Sep 17 00:00:00 2001 From: leiiyb Date: Wed, 11 Jan 2023 17:03:50 +0800 Subject: [PATCH 1/2] add getVersion and setVersion interfaces Signed-off-by: leiiyb --- api/@ohos.data.relationalStore.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/api/@ohos.data.relationalStore.d.ts b/api/@ohos.data.relationalStore.d.ts index 3556635e56..4605f30160 100644 --- a/api/@ohos.data.relationalStore.d.ts +++ b/api/@ohos.data.relationalStore.d.ts @@ -723,6 +723,24 @@ declare namespace relationalStore */ obtainDistributedTableName(device: string, table: string): Promise; + /** + * Set database version. + * + * @param {number} version - Indicates the database version, it must be a non-negative integer. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + setVersion(version: number): void; + + /** + * Get database version + * + * @returns {number} the database version, it is a non-negative integer. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + getVersion(): number; + /** * Sync data between devices. * -- Gitee From 0f609ed953b829fba5f64a16d846404cabbfb1ef Mon Sep 17 00:00:00 2001 From: leiiyb Date: Thu, 12 Jan 2023 09:44:23 +0800 Subject: [PATCH 2/2] Modify to asynchronous interface Signed-off-by: leiiyb --- api/@ohos.data.relationalStore.d.ts | 47 ++--------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) diff --git a/api/@ohos.data.relationalStore.d.ts b/api/@ohos.data.relationalStore.d.ts index 4605f30160..b089fbc337 100644 --- a/api/@ohos.data.relationalStore.d.ts +++ b/api/@ohos.data.relationalStore.d.ts @@ -227,30 +227,6 @@ declare namespace relationalStore ON_CONFLICT_REPLACE = 5, } - /** - * Returns RdbStore status when GetRdbStore is called. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @since 10 - */ - enum OpenStatus { - /** - * Indicates that the RDB database is in the creation state. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @since 10 - */ - ON_CREATE = 0, - - /** - * Indicates that the RDB database is in the open state. - * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @since 10 - */ - ON_OPEN = 1, - } - /** * Provides methods for managing the relational database (RDB). * @@ -261,12 +237,13 @@ declare namespace relationalStore */ interface RdbStore { /** - * Obtains the RdbStore {@link OpenStatus}. + * Obtains the RdbStore version. The version number must be an integer greater than 0. * + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ - openStatus: number; + version: number; /** * Inserts a row of data into the target table. @@ -723,24 +700,6 @@ declare namespace relationalStore */ obtainDistributedTableName(device: string, table: string): Promise; - /** - * Set database version. - * - * @param {number} version - Indicates the database version, it must be a non-negative integer. - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @since 10 - */ - setVersion(version: number): void; - - /** - * Get database version - * - * @returns {number} the database version, it is a non-negative integer. - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @since 10 - */ - getVersion(): number; - /** * Sync data between devices. * -- Gitee