161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkData 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport { ResultSet as _ResultSet } from './data/rdb/resultSet'; 2361847f8eSopenharmony_ciimport Context from './application/BaseContext'; 2461847f8eSopenharmony_ci 2561847f8eSopenharmony_ci/** 2661847f8eSopenharmony_ci * Provides methods for rdbStore create and delete. 2761847f8eSopenharmony_ci * 2861847f8eSopenharmony_ci * @namespace rdb 2961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 3061847f8eSopenharmony_ci * @since 7 3161847f8eSopenharmony_ci * @deprecated since 9 3261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore 3361847f8eSopenharmony_ci */ 3461847f8eSopenharmony_cideclare namespace rdb { 3561847f8eSopenharmony_ci /** 3661847f8eSopenharmony_ci * Obtains an RDB store. 3761847f8eSopenharmony_ci * You can set parameters of the RDB store as required. In general, this method is recommended 3861847f8eSopenharmony_ci * to obtain a rdb store. 3961847f8eSopenharmony_ci * 4061847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 4161847f8eSopenharmony_ci * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. 4261847f8eSopenharmony_ci * @param { number } version - Indicates the database version for upgrade or downgrade. 4361847f8eSopenharmony_ci * @param { AsyncCallback<RdbStore> } callback - The RDB store {@link RdbStore}. 4461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 4561847f8eSopenharmony_ci * @since 7 4661847f8eSopenharmony_ci * @deprecated since 9 4761847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.getRdbStore 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void; 5061847f8eSopenharmony_ci 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * Obtains an RDB store. 5361847f8eSopenharmony_ci * You can set parameters of the RDB store as required. In general, this method is recommended 5461847f8eSopenharmony_ci * to obtain a rdb store. 5561847f8eSopenharmony_ci * 5661847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 5761847f8eSopenharmony_ci * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. 5861847f8eSopenharmony_ci * @param { number } version - Indicates the database version for upgrade or downgrade. 5961847f8eSopenharmony_ci * @returns { Promise<RdbStore> } The RDB store {@link RdbStore}. 6061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 6161847f8eSopenharmony_ci * @since 7 6261847f8eSopenharmony_ci * @deprecated since 9 6361847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.getRdbStore 6461847f8eSopenharmony_ci */ 6561847f8eSopenharmony_ci function getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>; 6661847f8eSopenharmony_ci 6761847f8eSopenharmony_ci /** 6861847f8eSopenharmony_ci * Deletes the database with a specified name. 6961847f8eSopenharmony_ci * 7061847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 7161847f8eSopenharmony_ci * @param { string } name - Indicates the database name. 7261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of deleteRdbStore. 7361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 7461847f8eSopenharmony_ci * @since 7 7561847f8eSopenharmony_ci * @deprecated since 9 7661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.deleteRdbStore 7761847f8eSopenharmony_ci */ 7861847f8eSopenharmony_ci function deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void; 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Deletes the database with a specified name. 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @param { Context } context - Indicates the context of application or capability. 8361847f8eSopenharmony_ci * @param { string } name - Indicates the database name. 8461847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 8561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 8661847f8eSopenharmony_ci * @since 7 8761847f8eSopenharmony_ci * @deprecated since 9 8861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.deleteRdbStore 8961847f8eSopenharmony_ci */ 9061847f8eSopenharmony_ci function deleteRdbStore(context: Context, name: string): Promise<void>; 9161847f8eSopenharmony_ci 9261847f8eSopenharmony_ci /** 9361847f8eSopenharmony_ci * Indicates the database synchronization mode. 9461847f8eSopenharmony_ci * 9561847f8eSopenharmony_ci * @enum { number } 9661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 9761847f8eSopenharmony_ci * @since 8 9861847f8eSopenharmony_ci * @deprecated since 9 9961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.SyncMode 10061847f8eSopenharmony_ci */ 10161847f8eSopenharmony_ci enum SyncMode { 10261847f8eSopenharmony_ci /** 10361847f8eSopenharmony_ci * Indicates the data is pushed to remote device from local device. 10461847f8eSopenharmony_ci * 10561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 10661847f8eSopenharmony_ci * @since 8 10761847f8eSopenharmony_ci * @deprecated since 9 10861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PUSH 10961847f8eSopenharmony_ci */ 11061847f8eSopenharmony_ci SYNC_MODE_PUSH = 0, 11161847f8eSopenharmony_ci 11261847f8eSopenharmony_ci /** 11361847f8eSopenharmony_ci * Indicates the data is pulled from remote device to local device. 11461847f8eSopenharmony_ci * 11561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 11661847f8eSopenharmony_ci * @since 8 11761847f8eSopenharmony_ci * @deprecated since 9 11861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PULL 11961847f8eSopenharmony_ci */ 12061847f8eSopenharmony_ci SYNC_MODE_PULL = 1 12161847f8eSopenharmony_ci } 12261847f8eSopenharmony_ci 12361847f8eSopenharmony_ci /** 12461847f8eSopenharmony_ci * Describes the subscription type. 12561847f8eSopenharmony_ci * 12661847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 12761847f8eSopenharmony_ci * @enum { number } 12861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 12961847f8eSopenharmony_ci * @since 8 13061847f8eSopenharmony_ci * @deprecated since 9 13161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.SubscribeType 13261847f8eSopenharmony_ci */ 13361847f8eSopenharmony_ci enum SubscribeType { 13461847f8eSopenharmony_ci /** 13561847f8eSopenharmony_ci * Subscription to remote data changes 13661847f8eSopenharmony_ci * 13761847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 13861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 13961847f8eSopenharmony_ci * @since 8 14061847f8eSopenharmony_ci * @deprecated since 9 14161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE 14261847f8eSopenharmony_ci */ 14361847f8eSopenharmony_ci SUBSCRIBE_TYPE_REMOTE = 0 14461847f8eSopenharmony_ci } 14561847f8eSopenharmony_ci 14661847f8eSopenharmony_ci /** 14761847f8eSopenharmony_ci * Provides methods for managing the relational database (RDB). 14861847f8eSopenharmony_ci * This class provides methods for creating, querying, updating, and deleting RDBs. 14961847f8eSopenharmony_ci * 15061847f8eSopenharmony_ci * @interface RdbStore 15161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 15261847f8eSopenharmony_ci * @since 7 15361847f8eSopenharmony_ci * @deprecated since 9 15461847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore 15561847f8eSopenharmony_ci */ 15661847f8eSopenharmony_ci interface RdbStore { 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * Inserts a row of data into the target table. 15961847f8eSopenharmony_ci * 16061847f8eSopenharmony_ci * @param { string } table - Indicates the row of data to be inserted into the table. 16161847f8eSopenharmony_ci * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. 16261847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - The row ID if the operation is successful. returns -1 otherwise. 16361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 16461847f8eSopenharmony_ci * @since 7 16561847f8eSopenharmony_ci * @deprecated since 9 16661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.insert 16761847f8eSopenharmony_ci */ 16861847f8eSopenharmony_ci insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>): void; 16961847f8eSopenharmony_ci 17061847f8eSopenharmony_ci /** 17161847f8eSopenharmony_ci * Inserts a row of data into the target table. 17261847f8eSopenharmony_ci * 17361847f8eSopenharmony_ci * @param { string } table - Indicates the row of data to be inserted into the table. 17461847f8eSopenharmony_ci * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. 17561847f8eSopenharmony_ci * @returns { Promise<number> } Return the row ID if the operation is successful. return -1 otherwise. 17661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 17761847f8eSopenharmony_ci * @since 7 17861847f8eSopenharmony_ci * @deprecated since 9 17961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.insert 18061847f8eSopenharmony_ci */ 18161847f8eSopenharmony_ci insert(table: string, values: ValuesBucket): Promise<number>; 18261847f8eSopenharmony_ci 18361847f8eSopenharmony_ci /** 18461847f8eSopenharmony_ci * Inserts a batch of data into the target table. 18561847f8eSopenharmony_ci * 18661847f8eSopenharmony_ci * @param { string } table - Indicates the target table. 18761847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. 18861847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise. 18961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 19061847f8eSopenharmony_ci * @since 7 19161847f8eSopenharmony_ci * @deprecated since 9 19261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.batchInsert 19361847f8eSopenharmony_ci */ 19461847f8eSopenharmony_ci batchInsert(table: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void; 19561847f8eSopenharmony_ci 19661847f8eSopenharmony_ci /** 19761847f8eSopenharmony_ci * Inserts a batch of data into the target table. 19861847f8eSopenharmony_ci * 19961847f8eSopenharmony_ci * @param { string } table - Indicates the target table. 20061847f8eSopenharmony_ci * @param { Array<ValuesBucket> } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. 20161847f8eSopenharmony_ci * @returns { Promise<number> } Return the number of values that were inserted if the operation is successful. returns -1 otherwise. 20261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 20361847f8eSopenharmony_ci * @since 7 20461847f8eSopenharmony_ci * @deprecated since 9 20561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.batchInsert 20661847f8eSopenharmony_ci */ 20761847f8eSopenharmony_ci batchInsert(table: string, values: Array<ValuesBucket>): Promise<number>; 20861847f8eSopenharmony_ci 20961847f8eSopenharmony_ci /** 21061847f8eSopenharmony_ci * Updates data in the database based on a a specified instance object of RdbPredicates. 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database. 21361847f8eSopenharmony_ci * The key-value pairs are associated with column names of the database table. 21461847f8eSopenharmony_ci * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. 21561847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - The number of affected rows. 21661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 21761847f8eSopenharmony_ci * @since 7 21861847f8eSopenharmony_ci * @deprecated since 9 21961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.update 22061847f8eSopenharmony_ci */ 22161847f8eSopenharmony_ci update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback<number>): void; 22261847f8eSopenharmony_ci 22361847f8eSopenharmony_ci /** 22461847f8eSopenharmony_ci * Updates data in the database based on a a specified instance object of RdbPredicates. 22561847f8eSopenharmony_ci * 22661847f8eSopenharmony_ci * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database. 22761847f8eSopenharmony_ci * The key-value pairs are associated with column names of the database table. 22861847f8eSopenharmony_ci * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. 22961847f8eSopenharmony_ci * @returns { Promise<number> } Return the number of affected rows. 23061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 23161847f8eSopenharmony_ci * @since 7 23261847f8eSopenharmony_ci * @deprecated since 9 23361847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.update 23461847f8eSopenharmony_ci */ 23561847f8eSopenharmony_ci update(values: ValuesBucket, predicates: RdbPredicates): Promise<number>; 23661847f8eSopenharmony_ci 23761847f8eSopenharmony_ci /** 23861847f8eSopenharmony_ci * Deletes data from the database based on a specified instance object of RdbPredicates. 23961847f8eSopenharmony_ci * 24061847f8eSopenharmony_ci * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. 24161847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - The number of affected rows. 24261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 24361847f8eSopenharmony_ci * @since 7 24461847f8eSopenharmony_ci * @deprecated since 9 24561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.delete 24661847f8eSopenharmony_ci */ 24761847f8eSopenharmony_ci delete(predicates: RdbPredicates, callback: AsyncCallback<number>): void; 24861847f8eSopenharmony_ci 24961847f8eSopenharmony_ci /** 25061847f8eSopenharmony_ci * Deletes data from the database based on a specified instance object of RdbPredicates. 25161847f8eSopenharmony_ci * 25261847f8eSopenharmony_ci * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. 25361847f8eSopenharmony_ci * @returns { Promise<number> } Return the number of affected rows. 25461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 25561847f8eSopenharmony_ci * @since 7 25661847f8eSopenharmony_ci * @deprecated since 9 25761847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.delete 25861847f8eSopenharmony_ci */ 25961847f8eSopenharmony_ci delete(predicates: RdbPredicates): Promise<number>; 26061847f8eSopenharmony_ci 26161847f8eSopenharmony_ci /** 26261847f8eSopenharmony_ci * Queries data in the database based on specified conditions. 26361847f8eSopenharmony_ci * 26461847f8eSopenharmony_ci * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. 26561847f8eSopenharmony_ci * @param { Array<string> } columns - The columns to query. If the value is empty array, the query applies to all columns. 26661847f8eSopenharmony_ci * @param { AsyncCallback<ResultSet> } callback - The {@link ResultSet} object if the operation is successful. 26761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 26861847f8eSopenharmony_ci * @since 7 26961847f8eSopenharmony_ci * @deprecated since 9 27061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.query 27161847f8eSopenharmony_ci */ 27261847f8eSopenharmony_ci query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>): void; 27361847f8eSopenharmony_ci 27461847f8eSopenharmony_ci /** 27561847f8eSopenharmony_ci * Queries data in the database based on specified conditions. 27661847f8eSopenharmony_ci * 27761847f8eSopenharmony_ci * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. 27861847f8eSopenharmony_ci * @param { Array<string> } columns - The columns to query. If the value is null, the query applies to all columns. 27961847f8eSopenharmony_ci * @returns { Promise<ResultSet> } Return the {@link ResultSet} object if the operation is successful. 28061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 28161847f8eSopenharmony_ci * @since 7 28261847f8eSopenharmony_ci * @deprecated since 9 28361847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.query 28461847f8eSopenharmony_ci */ 28561847f8eSopenharmony_ci query(predicates: RdbPredicates, columns?: Array<string>): Promise<ResultSet>; 28661847f8eSopenharmony_ci 28761847f8eSopenharmony_ci /** 28861847f8eSopenharmony_ci * Queries data in the database based on SQL statement. 28961847f8eSopenharmony_ci * 29061847f8eSopenharmony_ci * @param { string } sql - Indicates the SQL statement to execute. 29161847f8eSopenharmony_ci * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. 29261847f8eSopenharmony_ci * @param { AsyncCallback<ResultSet> } callback 29361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 29461847f8eSopenharmony_ci * @since 8 29561847f8eSopenharmony_ci * @deprecated since 9 29661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.querySql 29761847f8eSopenharmony_ci */ 29861847f8eSopenharmony_ci querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>): void; 29961847f8eSopenharmony_ci 30061847f8eSopenharmony_ci /** 30161847f8eSopenharmony_ci * Queries data in the database based on SQL statement. 30261847f8eSopenharmony_ci * 30361847f8eSopenharmony_ci * @param { string } sql - Indicates the SQL statement to execute. 30461847f8eSopenharmony_ci * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. 30561847f8eSopenharmony_ci * @returns { Promise<ResultSet> } Return the {@link ResultSet} object if the operation is successful. 30661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 30761847f8eSopenharmony_ci * @since 8 30861847f8eSopenharmony_ci * @deprecated since 9 30961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.querySql 31061847f8eSopenharmony_ci */ 31161847f8eSopenharmony_ci querySql(sql: string, bindArgs?: Array<ValueType>): Promise<ResultSet>; 31261847f8eSopenharmony_ci 31361847f8eSopenharmony_ci /** 31461847f8eSopenharmony_ci * Executes an SQL statement that contains specified parameters but returns no value. 31561847f8eSopenharmony_ci * 31661847f8eSopenharmony_ci * @param { string } sql - Indicates the SQL statement to execute. 31761847f8eSopenharmony_ci * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. 31861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of executeSql. 31961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 32061847f8eSopenharmony_ci * @since 8 32161847f8eSopenharmony_ci * @deprecated since 9 32261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.executeSql 32361847f8eSopenharmony_ci */ 32461847f8eSopenharmony_ci executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<void>): void; 32561847f8eSopenharmony_ci 32661847f8eSopenharmony_ci /** 32761847f8eSopenharmony_ci * Executes an SQL statement that contains specified parameters but returns no value. 32861847f8eSopenharmony_ci * 32961847f8eSopenharmony_ci * @param { string } sql - Indicates the SQL statement to execute. 33061847f8eSopenharmony_ci * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. 33161847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 33261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 33361847f8eSopenharmony_ci * @since 8 33461847f8eSopenharmony_ci * @deprecated since 9 33561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.executeSql 33661847f8eSopenharmony_ci */ 33761847f8eSopenharmony_ci executeSql(sql: string, bindArgs?: Array<ValueType>): Promise<void>; 33861847f8eSopenharmony_ci 33961847f8eSopenharmony_ci /** 34061847f8eSopenharmony_ci * Begin Transaction before execute your sql. 34161847f8eSopenharmony_ci * 34261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 34361847f8eSopenharmony_ci * @since 8 34461847f8eSopenharmony_ci * @deprecated since 9 34561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.beginTransaction 34661847f8eSopenharmony_ci */ 34761847f8eSopenharmony_ci beginTransaction(): void; 34861847f8eSopenharmony_ci 34961847f8eSopenharmony_ci /** 35061847f8eSopenharmony_ci * Commit the the sql you have executed. 35161847f8eSopenharmony_ci * 35261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 35361847f8eSopenharmony_ci * @since 8 35461847f8eSopenharmony_ci * @deprecated since 9 35561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.commit 35661847f8eSopenharmony_ci */ 35761847f8eSopenharmony_ci commit(): void; 35861847f8eSopenharmony_ci 35961847f8eSopenharmony_ci /** 36061847f8eSopenharmony_ci * Roll back the sql you have already executed. 36161847f8eSopenharmony_ci * 36261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 36361847f8eSopenharmony_ci * @since 8 36461847f8eSopenharmony_ci * @deprecated since 9 36561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.rollBack 36661847f8eSopenharmony_ci */ 36761847f8eSopenharmony_ci rollBack(): void; 36861847f8eSopenharmony_ci 36961847f8eSopenharmony_ci /** 37061847f8eSopenharmony_ci * Set table to be distributed table. 37161847f8eSopenharmony_ci * 37261847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 37361847f8eSopenharmony_ci * @param { Array<string> } tables - Indicates the tables name you want to set. 37461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of setDistributedTables. 37561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 37661847f8eSopenharmony_ci * @since 8 37761847f8eSopenharmony_ci * @deprecated since 9 37861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables 37961847f8eSopenharmony_ci */ 38061847f8eSopenharmony_ci setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void; 38161847f8eSopenharmony_ci 38261847f8eSopenharmony_ci /** 38361847f8eSopenharmony_ci * Set table to be distributed table. 38461847f8eSopenharmony_ci * 38561847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 38661847f8eSopenharmony_ci * @param { Array<string> } tables - Indicates the tables name you want to set. 38761847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 38861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 38961847f8eSopenharmony_ci * @since 8 39061847f8eSopenharmony_ci * @deprecated since 9 39161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables 39261847f8eSopenharmony_ci */ 39361847f8eSopenharmony_ci setDistributedTables(tables: Array<string>): Promise<void>; 39461847f8eSopenharmony_ci 39561847f8eSopenharmony_ci /** 39661847f8eSopenharmony_ci * Obtain distributed table name of specified remote device according to local table name. 39761847f8eSopenharmony_ci * When query remote device database, distributed table name is needed. 39861847f8eSopenharmony_ci * 39961847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 40061847f8eSopenharmony_ci * @param { string } device - Indicates the remote device. 40161847f8eSopenharmony_ci * @param { string } table - {string}: The distributed table name. 40261847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback 40361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 40461847f8eSopenharmony_ci * @since 8 40561847f8eSopenharmony_ci * @deprecated since 9 40661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName 40761847f8eSopenharmony_ci */ 40861847f8eSopenharmony_ci obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void; 40961847f8eSopenharmony_ci 41061847f8eSopenharmony_ci /** 41161847f8eSopenharmony_ci * Obtain distributed table name of specified remote device according to local table name. 41261847f8eSopenharmony_ci * When query remote device database, distributed table name is needed. 41361847f8eSopenharmony_ci * 41461847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 41561847f8eSopenharmony_ci * @param { string } device - Indicates the remote device. 41661847f8eSopenharmony_ci * @param { string } table 41761847f8eSopenharmony_ci * @returns { Promise<string> } {string}: The distributed table name. 41861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 41961847f8eSopenharmony_ci * @since 8 42061847f8eSopenharmony_ci * @deprecated since 9 42161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName 42261847f8eSopenharmony_ci */ 42361847f8eSopenharmony_ci obtainDistributedTableName(device: string, table: string): Promise<string>; 42461847f8eSopenharmony_ci 42561847f8eSopenharmony_ci /** 42661847f8eSopenharmony_ci * Sync data between devices. 42761847f8eSopenharmony_ci * 42861847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 42961847f8eSopenharmony_ci * @param { SyncMode } mode - Indicates the remote device. 43061847f8eSopenharmony_ci * @param { RdbPredicates } predicates - {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status. 43161847f8eSopenharmony_ci * @param { AsyncCallback<Array<[string, number]>> } callback 43261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 43361847f8eSopenharmony_ci * @since 8 43461847f8eSopenharmony_ci * @deprecated since 9 43561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.sync 43661847f8eSopenharmony_ci */ 43761847f8eSopenharmony_ci sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void; 43861847f8eSopenharmony_ci 43961847f8eSopenharmony_ci /** 44061847f8eSopenharmony_ci * Sync data between devices. 44161847f8eSopenharmony_ci * 44261847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 44361847f8eSopenharmony_ci * @param { SyncMode } mode - Indicates the remote device. 44461847f8eSopenharmony_ci * @param { RdbPredicates } predicates 44561847f8eSopenharmony_ci * @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status. 44661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 44761847f8eSopenharmony_ci * @since 8 44861847f8eSopenharmony_ci * @deprecated since 9 44961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.sync 45061847f8eSopenharmony_ci */ 45161847f8eSopenharmony_ci sync(mode: SyncMode, predicates: RdbPredicates): Promise<Array<[string, number]>>; 45261847f8eSopenharmony_ci 45361847f8eSopenharmony_ci /** 45461847f8eSopenharmony_ci * Registers an observer for the database. When data in the distributed database changes, 45561847f8eSopenharmony_ci * the callback will be invoked. 45661847f8eSopenharmony_ci * 45761847f8eSopenharmony_ci * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. 45861847f8eSopenharmony_ci * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. 45961847f8eSopenharmony_ci * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. 46061847f8eSopenharmony_ci * @param { Callback<Array<string>> } observer - {Array<string>}: The observer of data change events in the distributed database. 46161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 46261847f8eSopenharmony_ci * @since 8 46361847f8eSopenharmony_ci * @deprecated since 9 46461847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.on 46561847f8eSopenharmony_ci */ 46661847f8eSopenharmony_ci on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void; 46761847f8eSopenharmony_ci 46861847f8eSopenharmony_ci /** 46961847f8eSopenharmony_ci * Remove specified observer of specified type from the database. 47061847f8eSopenharmony_ci * 47161847f8eSopenharmony_ci * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. 47261847f8eSopenharmony_ci * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. 47361847f8eSopenharmony_ci * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. 47461847f8eSopenharmony_ci * @param { Callback<Array<string>> } observer - {Array<string>}: The data change observer already registered. 47561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 47661847f8eSopenharmony_ci * @since 8 47761847f8eSopenharmony_ci * @deprecated since 9 47861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbStore.off 47961847f8eSopenharmony_ci */ 48061847f8eSopenharmony_ci off(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void; 48161847f8eSopenharmony_ci } 48261847f8eSopenharmony_ci 48361847f8eSopenharmony_ci /** 48461847f8eSopenharmony_ci * Indicates possible value types 48561847f8eSopenharmony_ci * 48661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 48761847f8eSopenharmony_ci * @since 7 48861847f8eSopenharmony_ci * @deprecated since 9 48961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.ValueType 49061847f8eSopenharmony_ci */ 49161847f8eSopenharmony_ci type ValueType = number | string | boolean; 49261847f8eSopenharmony_ci 49361847f8eSopenharmony_ci /** 49461847f8eSopenharmony_ci * Values in buckets are stored in key-value pairs 49561847f8eSopenharmony_ci * 49661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 49761847f8eSopenharmony_ci * @since 7 49861847f8eSopenharmony_ci * @deprecated since 9 49961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.ValuesBucket 50061847f8eSopenharmony_ci */ 50161847f8eSopenharmony_ci type ValuesBucket = { [key: string]: ValueType | Uint8Array | null }; 50261847f8eSopenharmony_ci 50361847f8eSopenharmony_ci /** 50461847f8eSopenharmony_ci * Manages relational database configurations. 50561847f8eSopenharmony_ci * 50661847f8eSopenharmony_ci * @interface StoreConfig 50761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 50861847f8eSopenharmony_ci * @since 7 50961847f8eSopenharmony_ci * @deprecated since 9 51061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.StoreConfig 51161847f8eSopenharmony_ci */ 51261847f8eSopenharmony_ci interface StoreConfig { 51361847f8eSopenharmony_ci /** 51461847f8eSopenharmony_ci * Manages relational database configurations. 51561847f8eSopenharmony_ci * 51661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 51761847f8eSopenharmony_ci * @since 7 51861847f8eSopenharmony_ci * @deprecated since 9 51961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.StoreConfig 52061847f8eSopenharmony_ci */ 52161847f8eSopenharmony_ci name: string; 52261847f8eSopenharmony_ci } 52361847f8eSopenharmony_ci 52461847f8eSopenharmony_ci /** 52561847f8eSopenharmony_ci * Manages relational database configurations. 52661847f8eSopenharmony_ci * 52761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 52861847f8eSopenharmony_ci * @since 7 52961847f8eSopenharmony_ci * @deprecated since 9 53061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates 53161847f8eSopenharmony_ci */ 53261847f8eSopenharmony_ci class RdbPredicates { 53361847f8eSopenharmony_ci /** 53461847f8eSopenharmony_ci * A parameterized constructor used to create an RdbPredicates instance. 53561847f8eSopenharmony_ci * 53661847f8eSopenharmony_ci * @param { string } name - Indicates the table name of the database. 53761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 53861847f8eSopenharmony_ci * @since 7 53961847f8eSopenharmony_ci * @deprecated since 9 54061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.constructor 54161847f8eSopenharmony_ci */ 54261847f8eSopenharmony_ci constructor(name: string); 54361847f8eSopenharmony_ci 54461847f8eSopenharmony_ci /** 54561847f8eSopenharmony_ci * Sync data between devices. 54661847f8eSopenharmony_ci * When query database, this function should not be called. 54761847f8eSopenharmony_ci * 54861847f8eSopenharmony_ci * @param { Array<string> } devices - Indicates specified remote devices. 54961847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 55061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 55161847f8eSopenharmony_ci * @since 8 55261847f8eSopenharmony_ci * @deprecated since 9 55361847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.inDevices 55461847f8eSopenharmony_ci */ 55561847f8eSopenharmony_ci inDevices(devices: Array<string>): RdbPredicates; 55661847f8eSopenharmony_ci 55761847f8eSopenharmony_ci /** 55861847f8eSopenharmony_ci * Specify all remote devices which connect to local device when syncing distributed database. 55961847f8eSopenharmony_ci * When query database, this function should not be called. 56061847f8eSopenharmony_ci * 56161847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 56261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 56361847f8eSopenharmony_ci * @since 8 56461847f8eSopenharmony_ci * @deprecated since 9 56561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.inAllDevices 56661847f8eSopenharmony_ci */ 56761847f8eSopenharmony_ci inAllDevices(): RdbPredicates; 56861847f8eSopenharmony_ci 56961847f8eSopenharmony_ci /** 57061847f8eSopenharmony_ci * Configure the RdbPredicates to match the field whose data type is ValueType and value is equal 57161847f8eSopenharmony_ci * to a specified value. 57261847f8eSopenharmony_ci * This method is similar to = of the SQL statement. 57361847f8eSopenharmony_ci * 57461847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 57561847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 57661847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 57761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 57861847f8eSopenharmony_ci * @since 7 57961847f8eSopenharmony_ci * @deprecated since 9 58061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.equalTo 58161847f8eSopenharmony_ci */ 58261847f8eSopenharmony_ci equalTo(field: string, value: ValueType): RdbPredicates; 58361847f8eSopenharmony_ci 58461847f8eSopenharmony_ci /** 58561847f8eSopenharmony_ci * Configure the RdbPredicates to match the field whose data type is ValueType and value is not equal to 58661847f8eSopenharmony_ci * a specified value. 58761847f8eSopenharmony_ci * This method is similar to != of the SQL statement. 58861847f8eSopenharmony_ci * 58961847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 59061847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 59161847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 59261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 59361847f8eSopenharmony_ci * @since 7 59461847f8eSopenharmony_ci * @deprecated since 9 59561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.notEqualTo 59661847f8eSopenharmony_ci */ 59761847f8eSopenharmony_ci notEqualTo(field: string, value: ValueType): RdbPredicates; 59861847f8eSopenharmony_ci 59961847f8eSopenharmony_ci /** 60061847f8eSopenharmony_ci * Adds a left parenthesis to the RdbPredicates. 60161847f8eSopenharmony_ci * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). 60261847f8eSopenharmony_ci * 60361847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} with the left parenthesis. 60461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 60561847f8eSopenharmony_ci * @since 7 60661847f8eSopenharmony_ci * @deprecated since 9 60761847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.beginWrap 60861847f8eSopenharmony_ci */ 60961847f8eSopenharmony_ci beginWrap(): RdbPredicates; 61061847f8eSopenharmony_ci 61161847f8eSopenharmony_ci /** 61261847f8eSopenharmony_ci * Adds a right parenthesis to the RdbPredicates. 61361847f8eSopenharmony_ci * This method is similar to ) of the SQL statement and needs to be used together 61461847f8eSopenharmony_ci * with beginWrap(). 61561847f8eSopenharmony_ci * 61661847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} with the right parenthesis. 61761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 61861847f8eSopenharmony_ci * @since 7 61961847f8eSopenharmony_ci * @deprecated since 9 62061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.endWrap 62161847f8eSopenharmony_ci */ 62261847f8eSopenharmony_ci endWrap(): RdbPredicates; 62361847f8eSopenharmony_ci 62461847f8eSopenharmony_ci /** 62561847f8eSopenharmony_ci * Adds an or condition to the RdbPredicates. 62661847f8eSopenharmony_ci * This method is similar to or of the SQL statement. 62761847f8eSopenharmony_ci * 62861847f8eSopenharmony_ci * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition. 62961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 63061847f8eSopenharmony_ci * @since 7 63161847f8eSopenharmony_ci * @deprecated since 9 63261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.or 63361847f8eSopenharmony_ci */ 63461847f8eSopenharmony_ci or(): RdbPredicates; 63561847f8eSopenharmony_ci 63661847f8eSopenharmony_ci /** 63761847f8eSopenharmony_ci * Adds an and condition to the RdbPredicates. 63861847f8eSopenharmony_ci * This method is similar to or of the SQL statement. 63961847f8eSopenharmony_ci * 64061847f8eSopenharmony_ci * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition. 64161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 64261847f8eSopenharmony_ci * @since 7 64361847f8eSopenharmony_ci * @deprecated since 9 64461847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.and 64561847f8eSopenharmony_ci */ 64661847f8eSopenharmony_ci and(): RdbPredicates; 64761847f8eSopenharmony_ci 64861847f8eSopenharmony_ci /** 64961847f8eSopenharmony_ci * Configure the RdbPredicates to match the field whose data type is string and value 65061847f8eSopenharmony_ci * contains a specified value. 65161847f8eSopenharmony_ci * This method is similar to contains of the SQL statement. 65261847f8eSopenharmony_ci * 65361847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 65461847f8eSopenharmony_ci * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. 65561847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 65661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 65761847f8eSopenharmony_ci * @since 7 65861847f8eSopenharmony_ci * @deprecated since 9 65961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.contains 66061847f8eSopenharmony_ci */ 66161847f8eSopenharmony_ci contains(field: string, value: string): RdbPredicates; 66261847f8eSopenharmony_ci 66361847f8eSopenharmony_ci /** 66461847f8eSopenharmony_ci * Configure the RdbPredicates to match the field whose data type is string and value starts 66561847f8eSopenharmony_ci * with a specified string. 66661847f8eSopenharmony_ci * This method is similar to value% of the SQL statement. 66761847f8eSopenharmony_ci * 66861847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 66961847f8eSopenharmony_ci * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. 67061847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 67161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 67261847f8eSopenharmony_ci * @since 7 67361847f8eSopenharmony_ci * @deprecated since 9 67461847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.beginsWith 67561847f8eSopenharmony_ci */ 67661847f8eSopenharmony_ci beginsWith(field: string, value: string): RdbPredicates; 67761847f8eSopenharmony_ci 67861847f8eSopenharmony_ci /** 67961847f8eSopenharmony_ci * Configure the RdbPredicates to match the field whose data type is string and value 68061847f8eSopenharmony_ci * ends with a specified string. 68161847f8eSopenharmony_ci * This method is similar to %value of the SQL statement. 68261847f8eSopenharmony_ci * 68361847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 68461847f8eSopenharmony_ci * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. 68561847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 68661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 68761847f8eSopenharmony_ci * @since 7 68861847f8eSopenharmony_ci * @deprecated since 9 68961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.endsWith 69061847f8eSopenharmony_ci */ 69161847f8eSopenharmony_ci endsWith(field: string, value: string): RdbPredicates; 69261847f8eSopenharmony_ci 69361847f8eSopenharmony_ci /** 69461847f8eSopenharmony_ci * Configure the RdbPredicates to match the fields whose value is null. 69561847f8eSopenharmony_ci * This method is similar to is null of the SQL statement. 69661847f8eSopenharmony_ci * 69761847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 69861847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 69961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 70061847f8eSopenharmony_ci * @since 7 70161847f8eSopenharmony_ci * @deprecated since 9 70261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.isNull 70361847f8eSopenharmony_ci */ 70461847f8eSopenharmony_ci isNull(field: string): RdbPredicates; 70561847f8eSopenharmony_ci 70661847f8eSopenharmony_ci /** 70761847f8eSopenharmony_ci * Configure the RdbPredicates to match the specified fields whose value is not null. 70861847f8eSopenharmony_ci * This method is similar to is not null of the SQL statement. 70961847f8eSopenharmony_ci * 71061847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 71161847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} self. 71261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 71361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 71461847f8eSopenharmony_ci * @since 7 71561847f8eSopenharmony_ci * @deprecated since 9 71661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.isNotNull 71761847f8eSopenharmony_ci */ 71861847f8eSopenharmony_ci isNotNull(field: string): RdbPredicates; 71961847f8eSopenharmony_ci 72061847f8eSopenharmony_ci /** 72161847f8eSopenharmony_ci * Configure the RdbPredicates to match the fields whose data type is string and value is 72261847f8eSopenharmony_ci * similar to a specified string. 72361847f8eSopenharmony_ci * This method is similar to like of the SQL statement. 72461847f8eSopenharmony_ci * 72561847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 72661847f8eSopenharmony_ci * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. 72761847f8eSopenharmony_ci * @returns { RdbPredicates } - The {@link RdbPredicates} that match the specified field. 72861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 72961847f8eSopenharmony_ci * @since 7 73061847f8eSopenharmony_ci * @deprecated since 9 73161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.like 73261847f8eSopenharmony_ci */ 73361847f8eSopenharmony_ci like(field: string, value: string): RdbPredicates; 73461847f8eSopenharmony_ci 73561847f8eSopenharmony_ci /** 73661847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is string and the value contains 73761847f8eSopenharmony_ci * a wildcard. 73861847f8eSopenharmony_ci * Different from like, the input parameters of this method are case-sensitive. 73961847f8eSopenharmony_ci * 74061847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 74161847f8eSopenharmony_ci * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. 74261847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 74361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 74461847f8eSopenharmony_ci * @since 7 74561847f8eSopenharmony_ci * @deprecated since 9 74661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.glob 74761847f8eSopenharmony_ci */ 74861847f8eSopenharmony_ci glob(field: string, value: string): RdbPredicates; 74961847f8eSopenharmony_ci 75061847f8eSopenharmony_ci /** 75161847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is string and the value contains 75261847f8eSopenharmony_ci * a wildcard. 75361847f8eSopenharmony_ci * 75461847f8eSopenharmony_ci * @param { string } field - Indicates the column name. 75561847f8eSopenharmony_ci * @param { ValueType } low - Indicates the minimum value. 75661847f8eSopenharmony_ci * @param { ValueType } high - Indicates the maximum value. 75761847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 75861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 75961847f8eSopenharmony_ci * @since 7 76061847f8eSopenharmony_ci * @deprecated since 9 76161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.between 76261847f8eSopenharmony_ci */ 76361847f8eSopenharmony_ci between(field: string, low: ValueType, high: ValueType): RdbPredicates; 76461847f8eSopenharmony_ci 76561847f8eSopenharmony_ci /** 76661847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is int and value is 76761847f8eSopenharmony_ci * out of a given range. 76861847f8eSopenharmony_ci * 76961847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 77061847f8eSopenharmony_ci * @param { ValueType } low - Indicates the minimum value. 77161847f8eSopenharmony_ci * @param { ValueType } high - Indicates the maximum value to. 77261847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 77361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 77461847f8eSopenharmony_ci * @since 7 77561847f8eSopenharmony_ci * @deprecated since 9 77661847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.notBetween 77761847f8eSopenharmony_ci */ 77861847f8eSopenharmony_ci notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; 77961847f8eSopenharmony_ci 78061847f8eSopenharmony_ci /** 78161847f8eSopenharmony_ci * Restricts the value of the field to be greater than the specified value. 78261847f8eSopenharmony_ci * 78361847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 78461847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 78561847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 78661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 78761847f8eSopenharmony_ci * @since 7 78861847f8eSopenharmony_ci * @deprecated since 9 78961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThan 79061847f8eSopenharmony_ci */ 79161847f8eSopenharmony_ci greaterThan(field: string, value: ValueType): RdbPredicates; 79261847f8eSopenharmony_ci 79361847f8eSopenharmony_ci /** 79461847f8eSopenharmony_ci * Restricts the value of the field to be smaller than the specified value. 79561847f8eSopenharmony_ci * 79661847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 79761847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 79861847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 79961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 80061847f8eSopenharmony_ci * @since 7 80161847f8eSopenharmony_ci * @deprecated since 9 80261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.lessThan 80361847f8eSopenharmony_ci */ 80461847f8eSopenharmony_ci lessThan(field: string, value: ValueType): RdbPredicates; 80561847f8eSopenharmony_ci 80661847f8eSopenharmony_ci /** 80761847f8eSopenharmony_ci * Restricts the value of the field to be greater than or equal to the specified value. 80861847f8eSopenharmony_ci * 80961847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 81061847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 81161847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 81261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 81361847f8eSopenharmony_ci * @since 7 81461847f8eSopenharmony_ci * @deprecated since 9 81561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThanOrEqualTo 81661847f8eSopenharmony_ci */ 81761847f8eSopenharmony_ci greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates; 81861847f8eSopenharmony_ci 81961847f8eSopenharmony_ci /** 82061847f8eSopenharmony_ci * Restricts the value of the field to be smaller than or equal to the specified value. 82161847f8eSopenharmony_ci * 82261847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 82361847f8eSopenharmony_ci * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. 82461847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 82561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 82661847f8eSopenharmony_ci * @since 7 82761847f8eSopenharmony_ci * @deprecated since 9 82861847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.lessThanOrEqualTo 82961847f8eSopenharmony_ci */ 83061847f8eSopenharmony_ci lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates; 83161847f8eSopenharmony_ci 83261847f8eSopenharmony_ci /** 83361847f8eSopenharmony_ci * Restricts the ascending order of the return list. When there are several orders, 83461847f8eSopenharmony_ci * the one close to the head has the highest priority. 83561847f8eSopenharmony_ci * 83661847f8eSopenharmony_ci * @param { string } field - Indicates the column name for sorting the return list. 83761847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 83861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 83961847f8eSopenharmony_ci * @since 7 84061847f8eSopenharmony_ci * @deprecated since 9 84161847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.orderByAsc 84261847f8eSopenharmony_ci */ 84361847f8eSopenharmony_ci orderByAsc(field: string): RdbPredicates; 84461847f8eSopenharmony_ci 84561847f8eSopenharmony_ci /** 84661847f8eSopenharmony_ci * Restricts the descending order of the return list. When there are several orders, 84761847f8eSopenharmony_ci * the one close to the head has the highest priority. 84861847f8eSopenharmony_ci * 84961847f8eSopenharmony_ci * @param { string } field - Indicates the column name for sorting the return list. 85061847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 85161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 85261847f8eSopenharmony_ci * @since 7 85361847f8eSopenharmony_ci * @deprecated since 9 85461847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.orderByDesc 85561847f8eSopenharmony_ci */ 85661847f8eSopenharmony_ci orderByDesc(field: string): RdbPredicates; 85761847f8eSopenharmony_ci 85861847f8eSopenharmony_ci /** 85961847f8eSopenharmony_ci * Restricts each row of the query result to be unique. 86061847f8eSopenharmony_ci * 86161847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 86261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 86361847f8eSopenharmony_ci * @since 7 86461847f8eSopenharmony_ci * @deprecated since 9 86561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.distinct 86661847f8eSopenharmony_ci */ 86761847f8eSopenharmony_ci distinct(): RdbPredicates; 86861847f8eSopenharmony_ci 86961847f8eSopenharmony_ci /** 87061847f8eSopenharmony_ci * Restricts the max number of return records. 87161847f8eSopenharmony_ci * 87261847f8eSopenharmony_ci * @param { number } value - Indicates the max length of the return list. 87361847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 87461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 87561847f8eSopenharmony_ci * @since 7 87661847f8eSopenharmony_ci * @deprecated since 9 87761847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.limitAs 87861847f8eSopenharmony_ci */ 87961847f8eSopenharmony_ci limitAs(value: number): RdbPredicates; 88061847f8eSopenharmony_ci 88161847f8eSopenharmony_ci /** 88261847f8eSopenharmony_ci * Configure RdbPredicates to specify the start position of the returned result. 88361847f8eSopenharmony_ci * Use this method together with limit(int). 88461847f8eSopenharmony_ci * 88561847f8eSopenharmony_ci * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer. 88661847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 88761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 88861847f8eSopenharmony_ci * @since 7 88961847f8eSopenharmony_ci * @deprecated since 9 89061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.offsetAs 89161847f8eSopenharmony_ci */ 89261847f8eSopenharmony_ci offsetAs(rowOffset: number): RdbPredicates; 89361847f8eSopenharmony_ci 89461847f8eSopenharmony_ci /** 89561847f8eSopenharmony_ci * Configure RdbPredicates to group query results by specified columns. 89661847f8eSopenharmony_ci * 89761847f8eSopenharmony_ci * @param { Array<string> } fields - Indicates the specified columns by which query results are grouped. 89861847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. 89961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 90061847f8eSopenharmony_ci * @since 7 90161847f8eSopenharmony_ci * @deprecated since 9 90261847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.groupBy 90361847f8eSopenharmony_ci */ 90461847f8eSopenharmony_ci groupBy(fields: Array<string>): RdbPredicates; 90561847f8eSopenharmony_ci 90661847f8eSopenharmony_ci /** 90761847f8eSopenharmony_ci * Configure RdbPredicates to specify the index column. 90861847f8eSopenharmony_ci * Before using this method, you need to create an index column. 90961847f8eSopenharmony_ci * 91061847f8eSopenharmony_ci * @param { string } field - Indicates the name of the index column. 91161847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 91261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 91361847f8eSopenharmony_ci * @since 7 91461847f8eSopenharmony_ci * @deprecated since 9 91561847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.indexedBy 91661847f8eSopenharmony_ci */ 91761847f8eSopenharmony_ci indexedBy(field: string): RdbPredicates; 91861847f8eSopenharmony_ci 91961847f8eSopenharmony_ci /** 92061847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is ValueType array and values 92161847f8eSopenharmony_ci * are within a given range. 92261847f8eSopenharmony_ci * 92361847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 92461847f8eSopenharmony_ci * @param { Array<ValueType> } value - Indicates the values to match with {@link RdbPredicates}. 92561847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 92661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 92761847f8eSopenharmony_ci * @since 7 92861847f8eSopenharmony_ci * @deprecated since 9 92961847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.in 93061847f8eSopenharmony_ci */ 93161847f8eSopenharmony_ci in(field: string, value: Array<ValueType>): RdbPredicates; 93261847f8eSopenharmony_ci 93361847f8eSopenharmony_ci /** 93461847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is ValueType array and values 93561847f8eSopenharmony_ci * are out of a given range. 93661847f8eSopenharmony_ci * 93761847f8eSopenharmony_ci * @param { string } field - Indicates the column name in the database table. 93861847f8eSopenharmony_ci * @param { Array<ValueType> } value - Indicates the values to match with {@link RdbPredicates}. 93961847f8eSopenharmony_ci * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. 94061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 94161847f8eSopenharmony_ci * @since 7 94261847f8eSopenharmony_ci * @deprecated since 9 94361847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.RdbPredicates.notIn 94461847f8eSopenharmony_ci */ 94561847f8eSopenharmony_ci notIn(field: string, value: Array<ValueType>): RdbPredicates; 94661847f8eSopenharmony_ci } 94761847f8eSopenharmony_ci 94861847f8eSopenharmony_ci /** 94961847f8eSopenharmony_ci * Configure RdbPredicates to match the specified field whose data type is ValueType array and values 95061847f8eSopenharmony_ci * are out of a given range. 95161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 95261847f8eSopenharmony_ci * @since 7 95361847f8eSopenharmony_ci * @deprecated since 9 95461847f8eSopenharmony_ci */ 95561847f8eSopenharmony_ci export type ResultSet = _ResultSet; 95661847f8eSopenharmony_ci} 95761847f8eSopenharmony_ci 95861847f8eSopenharmony_ci/** 95961847f8eSopenharmony_ci * Provides methods for rdbStore create and delete. 96061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 96161847f8eSopenharmony_ci * @since 7 96261847f8eSopenharmony_ci * @deprecated since 9 96361847f8eSopenharmony_ci */ 96461847f8eSopenharmony_ciexport default rdb; 965