diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 7c303b80c7719a3e95c59e5ecef09720200b7c16..e21dc7b043f7a966e43727284d01302769614799 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1289,7 +1289,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#put */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; - put(key: string, value: Uint8Array | string | number | boolean): Promise; /** @@ -1306,7 +1305,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete */ delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; /** @@ -1352,6 +1350,20 @@ declare namespace distributedData { */ off(event: 'dataChange', listener?: Callback): void; + /** + * UnRegister the {@code KvStore} database synchronization callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** * Inserts key-value pairs into the {@code KvStore} database in batches. * @@ -1363,7 +1375,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch */ putBatch(entries: Entry[], callback: AsyncCallback): void; - putBatch(entries: Entry[]): Promise; /** @@ -1377,7 +1388,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch */ deleteBatch(keys: string[], callback: AsyncCallback): void; - deleteBatch(keys: string[]): Promise; /** @@ -1392,7 +1402,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction */ startTransaction(callback: AsyncCallback): void; - startTransaction(): Promise; /** @@ -1406,7 +1415,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit */ commit(callback: AsyncCallback): void; - commit(): Promise; /** @@ -1419,7 +1427,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback */ rollback(callback: AsyncCallback): void; - rollback(): Promise; /** @@ -1434,7 +1441,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync */ enableSync(enabled: boolean, callback: AsyncCallback): void; - enableSync(enabled: boolean): Promise; /** @@ -1451,7 +1457,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; - setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; } @@ -1484,7 +1489,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#get */ get(key: string, callback: AsyncCallback): void; - get(key: string): Promise; /** @@ -1500,7 +1504,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(keyPrefix: string, callback: AsyncCallback): void; - getEntries(keyPrefix: string): Promise; /** @@ -1516,7 +1519,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; /** @@ -1535,7 +1537,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; - getResultSet(keyPrefix: string): Promise; /** @@ -1550,7 +1551,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; /** @@ -1565,7 +1565,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; /** @@ -1581,7 +1580,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; /** @@ -1593,7 +1591,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; /** @@ -1613,6 +1610,21 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback + * in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** * Register a SingleKvStore database synchronization callback. *

Sync result is returned through asynchronous callback. @@ -1626,6 +1638,20 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** * UnRegister the SingleKvStore database synchronization callback. * @@ -1649,7 +1675,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; /** @@ -1664,7 +1689,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel */ getSecurityLevel(callback: AsyncCallback): void; - getSecurityLevel(): Promise; } @@ -1696,7 +1720,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get */ get(deviceId: string, key: string, callback: AsyncCallback): void; - get(deviceId: string, key: string): Promise; /** @@ -1713,7 +1736,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getEntries(deviceId: string, keyPrefix: string): Promise; /** @@ -1729,7 +1751,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; /** @@ -1744,7 +1765,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; - getEntries(deviceId: string, query: Query): Promise; /** @@ -1766,7 +1786,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getResultSet(deviceId: string, keyPrefix: string): Promise; /** @@ -1782,7 +1801,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; /** @@ -1797,7 +1815,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: Query): Promise; /** @@ -1812,7 +1829,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; /** @@ -1828,7 +1844,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; /** @@ -1843,7 +1858,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSize(deviceId: string, query: Query): Promise; /** @@ -1860,7 +1874,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; /** @@ -1882,6 +1895,23 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the + * callback in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** * Register a DeviceKVStore database synchronization callback. * @@ -1896,6 +1926,20 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** * UnRegister the DeviceKVStore database synchronization callback. * @@ -1951,7 +1995,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore */ getKVStore(storeId: string, options: Options): Promise; - getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; /** @@ -1976,7 +2019,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; - closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; /** @@ -1998,7 +2040,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; - deleteKVStore(appId: string, storeId: string): Promise; /** @@ -2015,7 +2056,6 @@ declare namespace distributedData { * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; - getAllKVStoreId(appId: string): Promise; /** diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 2ee6c9b9e551f3325c0e59887a1d95f6829ad9a8..9f076e0da9d1a3c42993b702467080da89f41167 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -163,6 +163,7 @@ declare namespace distributedKVStore { * @since 9 */ type: ValueType; + /** * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -184,6 +185,7 @@ declare namespace distributedKVStore { * @since 9 */ key: string; + /** * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -209,18 +211,21 @@ declare namespace distributedKVStore { * @since 9 */ insertEntries: Entry[]; + /** * Indicates data update records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ updateEntries: Entry[]; + /** * Indicates data deletion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ deleteEntries: Entry[]; + /** * Indicates the device id which brings the data change. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -242,12 +247,14 @@ declare namespace distributedKVStore { * @since 9 */ PULL_ONLY, + /** * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ PUSH_ONLY, + /** * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -364,18 +371,21 @@ declare namespace distributedKVStore { * @since 9 */ createIfMissing?: boolean; + /** * Indicates whether database files to be encrypted * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ encrypt?: boolean; + /** * Indicates whether to back up database files * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ backup?: boolean; + /** * Indicates whether database files are automatically synchronized * @permission ohos.permission.DISTRIBUTED_DATASYNC @@ -383,18 +393,21 @@ declare namespace distributedKVStore { * @since 9 */ autoSync?: boolean; + /** * Indicates the database type * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ kvStoreType?: KVStoreType; + /** * Indicates the database security level * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ securityLevel: SecurityLevel; + /** * Indicates the database schema * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -427,6 +440,7 @@ declare namespace distributedKVStore { * @since 9 */ root: FieldNode; + /** * Indicates the string array of json. * @@ -434,6 +448,7 @@ declare namespace distributedKVStore { * @since 9 */ indexes: Array; + /** * Indicates the mode of schema. * @@ -441,6 +456,7 @@ declare namespace distributedKVStore { * @since 9 */ mode: number; + /** * Indicates the skip size of schema. * @@ -493,6 +509,7 @@ declare namespace distributedKVStore { * @since 9 */ default: string; + /** * Indicates the nullable of database field. * @@ -500,6 +517,7 @@ declare namespace distributedKVStore { * @since 9 */ nullable: boolean; + /** * Indicates the type of value. * @@ -1003,7 +1021,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of put. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1020,7 +1038,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1033,7 +1051,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1046,7 +1064,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1059,7 +1077,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 @@ -1073,7 +1091,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 @@ -1088,8 +1106,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1103,8 +1120,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1117,8 +1133,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1132,8 +1147,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1147,8 +1161,7 @@ declare namespace distributedKVStore { * @param {AsyncCallback} callback - the callback of deleteBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1161,8 +1174,7 @@ declare namespace distributedKVStore { * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1176,7 +1188,7 @@ declare namespace distributedKVStore { * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @param {AsyncCallback} callback - the callback of removeDeviceData. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1190,7 +1202,7 @@ declare namespace distributedKVStore { * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1205,7 +1217,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1220,7 +1232,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1230,11 +1242,11 @@ declare namespace distributedKVStore { * Obtains all key-value pairs that match a specified key prefix. * * @param {string} keyPrefix - Indicates the key prefix to match. - \* @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs * that match the specified key prefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1248,7 +1260,7 @@ declare namespace distributedKVStore { * specified key prefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1262,8 +1274,7 @@ declare namespace distributedKVStore { * matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1277,8 +1288,7 @@ declare namespace distributedKVStore { * specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1296,7 +1306,7 @@ declare namespace distributedKVStore { * object matching the specified keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1314,7 +1324,7 @@ declare namespace distributedKVStore { * object matching the specified keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1328,7 +1338,7 @@ declare namespace distributedKVStore { * object matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1342,7 +1352,7 @@ declare namespace distributedKVStore { * object matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1356,7 +1366,7 @@ declare namespace distributedKVStore { * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1371,7 +1381,7 @@ declare namespace distributedKVStore { * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1408,7 +1418,7 @@ declare namespace distributedKVStore { * specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1422,7 +1432,7 @@ declare namespace distributedKVStore { * {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1434,8 +1444,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of backup. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1447,8 +1456,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1460,8 +1468,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of restore. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1473,8 +1480,7 @@ declare namespace distributedKVStore { * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1511,7 +1517,7 @@ declare namespace distributedKVStore { *

After the database transaction is started, you can submit or roll back the operation. * * @param {AsyncCallback} callback - the callback of startTransaction. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1523,7 +1529,7 @@ declare namespace distributedKVStore { *

After the database transaction is started, you can submit or roll back the operation. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1533,7 +1539,7 @@ declare namespace distributedKVStore { * Submits a transaction operation in the {@code SingleKVStore} database. * * @param {AsyncCallback} callback - the callback of commit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1543,7 +1549,7 @@ declare namespace distributedKVStore { * Submits a transaction operation in the {@code SingleKVStore} database. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1553,7 +1559,7 @@ declare namespace distributedKVStore { * Rolls back a transaction operation in the {@code SingleKVStore} database. * * @param {AsyncCallback} callback - the callback of rollback. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1563,7 +1569,7 @@ declare namespace distributedKVStore { * Rolls back a transaction operation in the {@code SingleKVStore} database. * * @returns {Promise} the promise returned by the function. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1689,7 +1695,7 @@ declare namespace distributedKVStore { * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1714,7 +1720,7 @@ declare namespace distributedKVStore { * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1737,7 +1743,7 @@ declare namespace distributedKVStore { * * @param {AsyncCallback} callback - {SecurityLevel}: the {@code SecurityLevel} * object indicates the security level of the database. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1748,7 +1754,7 @@ declare namespace distributedKVStore { * * @returns {Promise} {SecurityLevel}: the {@code SecurityLevel} object indicates * the security level of the database. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1768,7 +1774,37 @@ declare namespace distributedKVStore { */ interface DeviceKVStore extends SingleKVStore { /** - * Obtains the {@code String} value matching a specified device ID and key. + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {AsyncCallback} callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + + /** + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + + /** + * Obtains the value matching a specified device ID and key. * * @param {string} deviceId - Indicates the device to be queried. * @param {string} key - Indicates the key of the value to be queried. @@ -1778,14 +1814,14 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ get(deviceId: string, key: string, callback: AsyncCallback): void; /** - * Obtains the {@code String} value matching a specified device ID and key. + * Obtains the value matching a specified device ID and key. * * @param {string} deviceId - Indicates the device to be queried. * @param {string} key - Indicates the key of the value to be queried. @@ -1795,12 +1831,40 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ get(deviceId: string, key: string): Promise; + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + /** * Obtains all key-value pairs matching a specified device ID and key prefix. * @@ -1811,7 +1875,7 @@ declare namespace distributedKVStore { * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1827,12 +1891,40 @@ declare namespace distributedKVStore { * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getEntries(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the local device ID and + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. * @@ -1842,8 +1934,7 @@ declare namespace distributedKVStore { * matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1858,13 +1949,48 @@ declare namespace distributedKVStore { * specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getEntries(deviceId: string, query: Query): Promise; + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string): Promise; + /** * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. * @@ -1879,7 +2005,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1899,12 +2025,40 @@ declare namespace distributedKVStore { * object matching the specified deviceId and keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getResultSet(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query): Promise; + /** * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. * @@ -1914,7 +2068,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1929,12 +2083,42 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ getResultSet(deviceId: string, query: Query): Promise; + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + /** * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. * @@ -1944,7 +2128,7 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 @@ -1960,13 +2144,41 @@ declare namespace distributedKVStore { * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the local device ID and specified + * {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + /** * Obtains the number of results matching a specified device ID and {@code Query} object. * @@ -1976,7 +2188,7 @@ declare namespace distributedKVStore { * specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -1991,7 +2203,7 @@ declare namespace distributedKVStore { * deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */