From 5669341ac8f5177391d2ed12f29d7c764db2ece5 Mon Sep 17 00:00:00 2001 From: lvcong_oh Date: Mon, 8 Apr 2024 18:48:47 +0800 Subject: [PATCH] add lock/unlock function --- .../include/relational_store.h | 39 +++++++++++++++++++ .../relational_store/libnative_rdb.ndk.json | 5 ++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index fcd70f2eb..884e0b634 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -897,6 +897,45 @@ int OH_Rdb_SubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObse * @since 11 */ int OH_Rdb_UnsubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObserver *observer); + +/** + * @brief Lock data from the database based on specified conditions. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param predicates Represents a pointer to an {@link OH_Predicates} instance. + * Indicates the specified lock condition. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store, OH_Predicates, OH_Rdb_ErrCode. + * @since 12 + */ +int OH_Rdb_LockRow(OH_Rdb_Store *store, OH_Predicates *predicates); + +/** + * @brief Unlock data from the database based on specified conditions. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param predicates Represents a pointer to an {@link OH_Predicates} instance. + * Indicates the specified unlock condition. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store, OH_Predicates, OH_Rdb_ErrCode. + * @since 12 + */ +int OH_Rdb_UnlockRow(OH_Rdb_Store *store, OH_Predicates *predicates); + +/** + * @brief Queries data in the database based on specified conditions. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param predicates Represents a pointer to an {@link OH_Predicates} instance. + * Indicates the specified query condition. + * @param columnNames Indicates the columns to query. If the value is empty array, the query applies to all columns. + * @param length Indicates the length of columnNames. + * @return If the query is successful, a pointer to the instance of the @link OH_Cursor} structure is returned, + * otherwise NULL is returned. + * @see OH_Rdb_Store, OH_Predicates, OH_Cursor. + * @since 12 + */ +OH_Cursor *OH_Rdb_QueryLockedRow(OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length); #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index 3ca54056f..68882bc8a 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -45,5 +45,8 @@ {"name":"OH_Rdb_Subscribe"}, {"name":"OH_Rdb_Unsubscribe"}, {"name":"OH_Rdb_SubscribeAutoSyncProgress"}, - {"name":"OH_Rdb_UnsubscribeAutoSyncProgress"} + {"name":"OH_Rdb_UnsubscribeAutoSyncProgress"}, + {"name":"OH_Rdb_LockRow"}, + {"name":"OH_Rdb_UnlockRow"}, + {"name":"OH_Rdb_QueryLockedRow"} ] \ No newline at end of file -- Gitee