diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index d77415c1bd1a037c2d2b5a9985eb892b9b20753b..40885c78d1f7a7d83b110b829442cfb37e6879b8 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -135,8 +135,98 @@ 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. + * + * @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 *