diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 0244e6b8c120c6caff4170bc8dcf679848f36cd8..7b201962030b135a2f4962810375e669d23e0589 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -16,6 +16,7 @@ import {AsyncCallback, Callback} from './basic'; import { ResultSet } from './data/rdb/resultSet'; import Context from "./application/Context"; +import DataSharePredicates from './@ohos.data.DataSharePredicates'; /** * Provides methods for rdbStore create and delete. @@ -31,7 +32,6 @@ declare namespace rdb { * You can set parameters of the RDB store as required. In general, this method is recommended * to obtain a rdb store. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param context Indicates the context of application or capability. @@ -46,7 +46,6 @@ declare namespace rdb { /** * Deletes the database with a specified name. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param context Indicates the context of application or capability. @@ -61,7 +60,6 @@ declare namespace rdb { * * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import N/A */ enum SyncMode { /** @@ -69,7 +67,6 @@ declare namespace rdb { * * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import N/A */ SYNC_MODE_PUSH = 0, @@ -78,7 +75,6 @@ declare namespace rdb { * * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import N/A */ SYNC_MODE_PULL = 1, } @@ -88,14 +84,12 @@ declare namespace rdb { * * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import N/A */ enum SubscribeType { /** * Subscription to remote data changes * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import N/A */ SUBSCRIBE_TYPE_REMOTE = 0, } @@ -113,58 +107,91 @@ declare namespace rdb { /** * Inserts a row of data into the target table. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param name Indicates the target table. + * @param table 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: ValuesBucket, callback: AsyncCallback): void; - insert(name: string, values: ValuesBucket): Promise; + insert(table: string, values: ValuesBucket, callback: AsyncCallback): void; + insert(table: string, values: ValuesBucket): Promise; /** * Updates data in the database based on a a specified instance object of rdbPredicates. * - * @note N/A * @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, rdbPredicates: RdbPredicates, callback: AsyncCallback): void; - update(values: ValuesBucket, rdbPredicates: RdbPredicates): Promise; + 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 DataSharePredicates. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param table 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 DataSharePredicates. + * @return Returns the number of affected rows. + */ + update(table: string, values: ValuesBucket, predicates: DataSharePredicates, callback: AsyncCallback): void; + update(table: string, values: ValuesBucket, predicates: DataSharePredicates): Promise; + /** * Deletes data from the database based on a specified instance object of rdbPredicates. * - * @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(predicates: RdbPredicates, callback: AsyncCallback): void; + delete(predicates: RdbPredicates): Promise; + + /** + * Deletes data from the database based on a specified instance object of DataSharePredicates. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param table Indicates the target table. + * @param predicates Indicates the specified delete condition by the instance object of DataSharePredicates. * @return Returns the number of affected rows. */ - delete(rdbPredicates: RdbPredicates, callback: AsyncCallback): void; - delete(rdbPredicates: RdbPredicates): Promise; + delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback): void; + delete(table: string, predicates: DataSharePredicates): Promise; /** * Queries data in the database based on specified conditions. * - * @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(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + query(predicates: RdbPredicates, columns?: Array): Promise; + + /** + * Queries data in the database based on specified conditions. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @param table Indicates the target table. + * @param predicates Indicates the specified query condition by the instance object of DataSharePredicates. * @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(table: string, predicates: DataSharePredicates, columns: Array, callback: AsyncCallback): void; + query(table: string, predicates: DataSharePredicates, columns?: Array): Promise; /** * Queries data in the database based on SQL statement. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param sql Indicates the SQL statement to execute. @@ -177,7 +204,6 @@ declare namespace rdb { /** * Executes an SQL statement that contains specified parameters but returns no value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param sql Indicates the SQL statement to execute. @@ -189,7 +215,6 @@ declare namespace rdb { /** * beginTransaction before excute your sql * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ @@ -198,7 +223,6 @@ declare namespace rdb { /** * commit the the sql you have excuted. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ @@ -207,7 +231,6 @@ declare namespace rdb { /** * roll back the sql you have already excuted * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ @@ -216,7 +239,6 @@ declare namespace rdb { /** * Set table to be distributed table. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param tables the tables name you want to set @@ -229,7 +251,6 @@ declare namespace rdb { * Obtain distributed table name of specified remote device according to local table name. * When query remote device database, distributed table name is needed. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param device Indicates the remote device. @@ -243,7 +264,6 @@ declare namespace rdb { /** * Sync data between devices * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param mode Indicates the synchronization mode. The value can be PUSH, PULL. @@ -258,7 +278,6 @@ declare namespace rdb { * Registers an observer for the database. When data in the distributed database changes, * the callback will be invoked. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. @@ -270,7 +289,6 @@ declare namespace rdb { /** * Remove specified observer of specified type from the database. * - * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. @@ -323,7 +341,6 @@ declare namespace rdb { * A parameterized constructor used to create an RdbPredicates instance. * name Indicates the table name of the database. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core */ @@ -508,7 +525,6 @@ declare namespace rdb { /** * Restricts the value of the field to the range between low value and high value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name. @@ -522,7 +538,6 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is int and value is * out of a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name in the database table. @@ -535,7 +550,6 @@ declare namespace rdb { /** * Restricts the value of the field to be greater than the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name. @@ -547,7 +561,6 @@ declare namespace rdb { /** * Restricts the value of the field to be smaller than the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name. @@ -559,7 +572,6 @@ declare namespace rdb { /** * Restricts the value of the field to be greater than or equal to the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name. @@ -571,7 +583,6 @@ declare namespace rdb { /** * Restricts the value of the field to be smaller than or equal to the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name. @@ -584,7 +595,6 @@ declare namespace rdb { * Restricts the ascending order of the return list. When there are several orders, * the one close to the head has the highest priority. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name for sorting the return list. @@ -596,7 +606,6 @@ declare namespace rdb { * Restricts the descending order of the return list. When there are several orders, * the one close to the head has the highest priority. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name for sorting the return list. @@ -607,7 +616,6 @@ declare namespace rdb { /** * Restricts each row of the query result to be unique. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @return Returns the SQL query statement with the specified RdbPredicates. @@ -617,7 +625,6 @@ declare namespace rdb { /** * Restricts the max number of return records. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param value Indicates the max length of the return list. @@ -639,7 +646,6 @@ declare namespace rdb { /** * Configures RdbPredicates to group query results by specified columns. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param fields Indicates the specified columns by which query results are grouped. @@ -662,7 +668,6 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is ValueType array and values * are within a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name in the database table. @@ -675,7 +680,6 @@ declare namespace rdb { * Configures RdbPredicates to match the specified field whose data type is ValueType array and values * are out of a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @param field Indicates the column name in the database table.