diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index f49a6db5ce8e98afa1885038a7d08764a9bb77b0..81786c434597d93cb3e8b828a7778910e5f967ea 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -16,7 +16,8 @@ import {AsyncCallback, Callback} from './basic'; import { ResultSet } from './data/rdb/resultSet'; import Context from "./application/Context"; - +import DataSharePredicates from './@ohos.data.DataSharePredicates'; +import { DataShareValuesBucket } from "./@ohos.data.DataShareValuesBucket"; /** * Provides methods for rdbStore create and delete. * @@ -123,6 +124,19 @@ declare namespace rdb { insert(name: string, values: ValuesBucket, callback: AsyncCallback): void; insert(name: string, values: ValuesBucket): Promise; + /** + * Inserts a row of data into the target table. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param name Indicates the target table. + * @param values Indicates the row of data to be inserted into the table. + * @return Returns the row ID if the operation is successful; returns -1 otherwise. + */ + insert(name: string, values: DataShareValuesBucket, callback: AsyncCallback): void; + insert(name: string, values: DataShareValuesBucket): Promise; + /** * Updates data in the database based on a a specified instance object of rdbPredicates. * @@ -130,11 +144,25 @@ declare namespace rdb { * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param values Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. - * @param rdbPredicates Indicates the specified update condition by the instance object of RdbPredicates. + * @param predicates Indicates the specified update condition by the instance object of RdbPredicates. + * @return Returns the number of affected rows. + */ + update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback): void; + update(values: ValuesBucket, predicates: RdbPredicates): Promise; + + /** + * Updates data in the database based on a a specified instance object of rdbPredicates. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param name Indicates the target table. + * @param values Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param predicates Indicates the specified update condition by the instance object of RdbPredicates. * @return Returns the number of affected rows. */ - update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallback): void; - update(values: ValuesBucket, rdbPredicates: RdbPredicates): Promise; + update(name: string, values: DataShareValuesBucket, predicates: DataSharePredicates, callback: AsyncCallback): void; + update(name: string, values: DataShareValuesBucket, predicates: DataSharePredicates): Promise; /** * Deletes data from the database based on a specified instance object of rdbPredicates. @@ -142,11 +170,24 @@ declare namespace rdb { * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param rdbPredicates Indicates the specified delete condition by the instance object of RdbPredicates. + * @param predicates Indicates the specified delete condition by the instance object of RdbPredicates. * @return Returns the number of affected rows. */ - delete(rdbPredicates: RdbPredicates, callback: AsyncCallback): void; - delete(rdbPredicates: RdbPredicates): Promise; + delete(predicates: RdbPredicates, callback: AsyncCallback): void; + delete(predicates: RdbPredicates): Promise; + + /** + * Deletes data from the database based on a specified instance object of rdbPredicates. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param name Indicates the target table. + * @param predicates Indicates the specified delete condition by the instance object of RdbPredicates. + * @return Returns the number of affected rows. + */ + delete(name: string, predicates: DataSharePredicates, callback: AsyncCallback): void; + delete(name: string, predicates: DataSharePredicates): Promise; /** * Queries data in the database based on specified conditions. @@ -154,12 +195,25 @@ declare namespace rdb { * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param rdbPredicates Indicates the specified query condition by the instance object of RdbPredicates. + * @param predicates Indicates the specified query condition by the instance object of RdbPredicates. * @param columns Indicates the columns to query. If the value is null, the query applies to all columns. * @return Returns a ResultSet object if the operation is successful; */ - query(rdbPredicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; - query(rdbPredicates: RdbPredicates, columns?: Array): Promise; + query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + query(predicates: RdbPredicates, columns?: Array): Promise; + + /** + * Queries data in the database based on specified conditions. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param predicates Indicates the specified query condition by the instance object of RdbPredicates. + * @param columns Indicates the columns to query. If the value is null, the query applies to all columns. + * @return Returns a DataShareResultSet object if the operation is successful; + */ + query(name: string, predicates: DataSharePredicates, columns: Array, callback: AsyncCallback): void; + query(name: string, predicates: DataSharePredicates, columns?: Array): Promise; /** * Queries data in the database based on SQL statement.