From 4bbc9e90e5975001d3e6484635b777062b0fcd33 Mon Sep 17 00:00:00 2001 From: lichenlong1 Date: Mon, 8 Nov 2021 09:49:57 +0800 Subject: [PATCH 1/2] description : add rdb transaction interface Signed-off-by: lichenlong1 --- api/@ohos.data.rdb.d.ts | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index d77415c1bd..0782805fbf 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -135,8 +135,85 @@ declare namespace rdb { */ executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; executeSql(sql: string, bindArgs: Array): Promise; + + /** + * Begin a transaction. + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @param transactionObserver while the transaction excutes, observer will be called + */ + beginTransaction(): void; + beginTransaction(transactionObserver: TransactionObserver): void; + + /** + * Begin a transaction. + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + */ + markAsCommit(): void; + + /** + * end a transaction. + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + */ + endTransaction(): void; + + /** + * return whether a connection is in a transaction + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + */ + isInTransaction(): void; } + interface TransactionObserver { + /** + * when the transcation bengin + * + * @note when transaction begin, this function will be called. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @return null. + */ + OnBegin(): void; + + /** + * when rdb commit the sql + * + * @note when rdb commit the sql + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @return null. + */ + OnCommit(field: string, value: ValueType): void; + + /** + * when rdb comes exception, this will be called. + * + * @note when exception happened, all the commit will be roll back. + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @return null. + */ + OnRollback(): void; + } + /** * Indicates possible value types * -- Gitee From 777561305389ccd37291af235e5c1257cf8892d2 Mon Sep 17 00:00:00 2001 From: lichenlong1 Date: Tue, 30 Nov 2021 19:39:50 +0800 Subject: [PATCH 2/2] description: from OpenHarmony / distributeddatamgr_appdatamgr issue, the no is : #I4FZ6G Signed-off-by: lichenlong1 --- api/@ohos.data.rdb.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 0782805fbf..40885c78d1 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -136,6 +136,19 @@ declare namespace rdb { executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; executeSql(sql: string, bindArgs: Array): Promise; + /** + * change the encrypted key(not null) if the database is configured with encrypted key. + * + * @note N/A + * @since 7 + * @sysCap SystemCapability.Data.DATA_APPDATAMGR + * @devices phone, tablet, tv, wearable, car + * @param the encrypted key is uint8 form in a vector. + * @param bindArgs Indicates the values of the parameters in the SQL statement. The values are strings. + */ + changeEncryptKey(newEncryptKey:Uint8Array, callback: AsyncCallback):void; + changeEncryptKey(newEncryptKey:Uint8Array): Promise; + /** * Begin a transaction. * -- Gitee