• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkData
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22import { ResultSet as _ResultSet } from './data/rdb/resultSet';
23import Context from './application/BaseContext';
24
25/**
26 * Provides methods for rdbStore create and delete.
27 *
28 * @namespace rdb
29 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
30 * @since 7
31 * @deprecated since 9
32 * @useinstead ohos.data.relationalStore
33 */
34declare namespace rdb {
35  /**
36   * Obtains an RDB store.
37   * You can set parameters of the RDB store as required. In general, this method is recommended
38   * to obtain a rdb store.
39   *
40   * @param { Context } context - Indicates the context of application or capability.
41   * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store.
42   * @param { number } version - Indicates the database version for upgrade or downgrade.
43   * @param { AsyncCallback<RdbStore> } callback - The RDB store {@link RdbStore}.
44   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
45   * @since 7
46   * @deprecated since 9
47   * @useinstead ohos.data.relationalStore.getRdbStore
48   */
49  function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void;
50
51  /**
52   * Obtains an RDB store.
53   * You can set parameters of the RDB store as required. In general, this method is recommended
54   * to obtain a rdb store.
55   *
56   * @param { Context } context - Indicates the context of application or capability.
57   * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store.
58   * @param { number } version - Indicates the database version for upgrade or downgrade.
59   * @returns { Promise<RdbStore> } The RDB store {@link RdbStore}.
60   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
61   * @since 7
62   * @deprecated since 9
63   * @useinstead ohos.data.relationalStore.getRdbStore
64   */
65  function getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>;
66
67  /**
68   * Deletes the database with a specified name.
69   *
70   * @param { Context } context - Indicates the context of application or capability.
71   * @param { string } name - Indicates the database name.
72   * @param { AsyncCallback<void> } callback - The callback of deleteRdbStore.
73   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
74   * @since 7
75   * @deprecated since 9
76   * @useinstead ohos.data.relationalStore.deleteRdbStore
77   */
78  function deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void;
79  /**
80   * Deletes the database with a specified name.
81   *
82   * @param { Context } context - Indicates the context of application or capability.
83   * @param { string } name - Indicates the database name.
84   * @returns { Promise<void> } The promise returned by the function.
85   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
86   * @since 7
87   * @deprecated since 9
88   * @useinstead ohos.data.relationalStore.deleteRdbStore
89   */
90  function deleteRdbStore(context: Context, name: string): Promise<void>;
91
92  /**
93   * Indicates the database synchronization mode.
94   *
95   * @enum { number }
96   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
97   * @since 8
98   * @deprecated since 9
99   * @useinstead ohos.data.relationalStore.SyncMode
100   */
101  enum SyncMode {
102    /**
103     * Indicates the data is pushed to remote device from local device.
104     *
105     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
106     * @since 8
107     * @deprecated since 9
108     * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PUSH
109     */
110    SYNC_MODE_PUSH = 0,
111
112    /**
113     * Indicates the data is pulled from remote device to local device.
114     *
115     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
116     * @since 8
117     * @deprecated since 9
118     * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PULL
119     */
120    SYNC_MODE_PULL = 1
121  }
122
123  /**
124   * Describes the subscription type.
125   *
126   * @permission ohos.permission.DISTRIBUTED_DATASYNC
127   * @enum { number }
128   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
129   * @since 8
130   * @deprecated since 9
131   * @useinstead ohos.data.relationalStore.SubscribeType
132   */
133  enum SubscribeType {
134    /**
135     * Subscription to remote data changes
136     *
137     * @permission ohos.permission.DISTRIBUTED_DATASYNC
138     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
139     * @since 8
140     * @deprecated since 9
141     * @useinstead ohos.data.relationalStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE
142     */
143    SUBSCRIBE_TYPE_REMOTE = 0
144  }
145
146  /**
147   * Provides methods for managing the relational database (RDB).
148   * This class provides methods for creating, querying, updating, and deleting RDBs.
149   *
150   * @interface RdbStore
151   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
152   * @since 7
153   * @deprecated since 9
154   * @useinstead ohos.data.relationalStore.RdbStore
155   */
156  interface RdbStore {
157    /**
158     * Inserts a row of data into the target table.
159     *
160     * @param { string } table - Indicates the row of data to be inserted into the table.
161     * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table.
162     * @param { AsyncCallback<number> } callback - The row ID if the operation is successful. returns -1 otherwise.
163     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
164     * @since 7
165     * @deprecated since 9
166     * @useinstead ohos.data.relationalStore.RdbStore.insert
167     */
168    insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>): void;
169
170    /**
171     * Inserts a row of data into the target table.
172     *
173     * @param { string } table - Indicates the row of data to be inserted into the table.
174     * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table.
175     * @returns { Promise<number> } Return the row ID if the operation is successful. return -1 otherwise.
176     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
177     * @since 7
178     * @deprecated since 9
179     * @useinstead ohos.data.relationalStore.RdbStore.insert
180     */
181    insert(table: string, values: ValuesBucket): Promise<number>;
182
183    /**
184     * Inserts a batch of data into the target table.
185     *
186     * @param { string } table - Indicates the target table.
187     * @param { Array<ValuesBucket> } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table.
188     * @param { AsyncCallback<number> } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise.
189     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
190     * @since 7
191     * @deprecated since 9
192     * @useinstead ohos.data.relationalStore.RdbStore.batchInsert
193     */
194    batchInsert(table: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
195
196    /**
197     * Inserts a batch of data into the target table.
198     *
199     * @param { string } table - Indicates the target table.
200     * @param { Array<ValuesBucket> } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table.
201     * @returns { Promise<number> } Return the number of values that were inserted if the operation is successful. returns -1 otherwise.
202     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
203     * @since 7
204     * @deprecated since 9
205     * @useinstead ohos.data.relationalStore.RdbStore.batchInsert
206     */
207    batchInsert(table: string, values: Array<ValuesBucket>): Promise<number>;
208
209    /**
210     * Updates data in the database based on a a specified instance object of RdbPredicates.
211     *
212     * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database.
213     * The key-value pairs are associated with column names of the database table.
214     * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of  {@link RdbPredicates}.
215     * @param { AsyncCallback<number> } callback - The number of affected rows.
216     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
217     * @since 7
218     * @deprecated since 9
219     * @useinstead ohos.data.relationalStore.RdbStore.update
220     */
221    update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback<number>): void;
222
223    /**
224     * Updates data in the database based on a a specified instance object of RdbPredicates.
225     *
226     * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database.
227     * The key-value pairs are associated with column names of the database table.
228     * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of  {@link RdbPredicates}.
229     * @returns { Promise<number> } Return the number of affected rows.
230     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
231     * @since 7
232     * @deprecated since 9
233     * @useinstead ohos.data.relationalStore.RdbStore.update
234     */
235    update(values: ValuesBucket, predicates: RdbPredicates): Promise<number>;
236
237    /**
238     * Deletes data from the database based on a specified instance object of RdbPredicates.
239     *
240     * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}.
241     * @param { AsyncCallback<number> } callback - The number of affected rows.
242     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
243     * @since 7
244     * @deprecated since 9
245     * @useinstead ohos.data.relationalStore.RdbStore.delete
246     */
247    delete(predicates: RdbPredicates, callback: AsyncCallback<number>): void;
248
249    /**
250     * Deletes data from the database based on a specified instance object of RdbPredicates.
251     *
252     * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}.
253     * @returns { Promise<number> } Return the number of affected rows.
254     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
255     * @since 7
256     * @deprecated since 9
257     * @useinstead ohos.data.relationalStore.RdbStore.delete
258     */
259    delete(predicates: RdbPredicates): Promise<number>;
260
261    /**
262     * Queries data in the database based on specified conditions.
263     *
264     * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}.
265     * @param { Array<string> } columns - The columns to query. If the value is empty array, the query applies to all columns.
266     * @param { AsyncCallback<ResultSet> } callback - The {@link ResultSet} object if the operation is successful.
267     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
268     * @since 7
269     * @deprecated since 9
270     * @useinstead ohos.data.relationalStore.RdbStore.query
271     */
272    query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>): void;
273
274    /**
275     * Queries data in the database based on specified conditions.
276     *
277     * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}.
278     * @param { Array<string> } columns - The columns to query. If the value is null, the query applies to all columns.
279     * @returns { Promise<ResultSet> } Return the {@link ResultSet} object if the operation is successful.
280     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
281     * @since 7
282     * @deprecated since 9
283     * @useinstead ohos.data.relationalStore.RdbStore.query
284     */
285    query(predicates: RdbPredicates, columns?: Array<string>): Promise<ResultSet>;
286
287    /**
288     * Queries data in the database based on SQL statement.
289     *
290     * @param { string } sql - Indicates the SQL statement to execute.
291     * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings.
292     * @param { AsyncCallback<ResultSet> } callback
293     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
294     * @since 8
295     * @deprecated since 9
296     * @useinstead ohos.data.relationalStore.RdbStore.querySql
297     */
298    querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>): void;
299
300    /**
301     * Queries data in the database based on SQL statement.
302     *
303     * @param { string } sql - Indicates the SQL statement to execute.
304     * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings.
305     * @returns { Promise<ResultSet> } Return the {@link ResultSet} object if the operation is successful.
306     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
307     * @since 8
308     * @deprecated since 9
309     * @useinstead ohos.data.relationalStore.RdbStore.querySql
310     */
311    querySql(sql: string, bindArgs?: Array<ValueType>): Promise<ResultSet>;
312
313    /**
314     * Executes an SQL statement that contains specified parameters but returns no value.
315     *
316     * @param { string } sql - Indicates the SQL statement to execute.
317     * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings.
318     * @param { AsyncCallback<void> } callback - The callback of executeSql.
319     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
320     * @since 8
321     * @deprecated since 9
322     * @useinstead ohos.data.relationalStore.RdbStore.executeSql
323     */
324    executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<void>): void;
325
326    /**
327     * Executes an SQL statement that contains specified parameters but returns no value.
328     *
329     * @param { string } sql - Indicates the SQL statement to execute.
330     * @param { Array<ValueType> } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings.
331     * @returns { Promise<void> } The promise returned by the function.
332     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
333     * @since 8
334     * @deprecated since 9
335     * @useinstead ohos.data.relationalStore.RdbStore.executeSql
336     */
337    executeSql(sql: string, bindArgs?: Array<ValueType>): Promise<void>;
338
339    /**
340     * Begin Transaction before execute your sql.
341     *
342     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
343     * @since 8
344     * @deprecated since 9
345     * @useinstead ohos.data.relationalStore.RdbStore.beginTransaction
346     */
347    beginTransaction(): void;
348
349    /**
350     * Commit the the sql you have executed.
351     *
352     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
353     * @since 8
354     * @deprecated since 9
355     * @useinstead ohos.data.relationalStore.RdbStore.commit
356     */
357    commit(): void;
358
359    /**
360     * Roll back the sql you have already executed.
361     *
362     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
363     * @since 8
364     * @deprecated since 9
365     * @useinstead ohos.data.relationalStore.RdbStore.rollBack
366     */
367    rollBack(): void;
368
369    /**
370     * Set table to be distributed table.
371     *
372     * @permission ohos.permission.DISTRIBUTED_DATASYNC
373     * @param { Array<string> } tables - Indicates the tables name you want to set.
374     * @param { AsyncCallback<void> } callback - The callback of setDistributedTables.
375     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
376     * @since 8
377     * @deprecated since 9
378     * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables
379     */
380    setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void;
381
382    /**
383     * Set table to be distributed table.
384     *
385     * @permission ohos.permission.DISTRIBUTED_DATASYNC
386     * @param { Array<string> } tables - Indicates the tables name you want to set.
387     * @returns { Promise<void> } The promise returned by the function.
388     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
389     * @since 8
390     * @deprecated since 9
391     * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables
392     */
393    setDistributedTables(tables: Array<string>): Promise<void>;
394
395    /**
396     * Obtain distributed table name of specified remote device according to local table name.
397     * When query remote device database, distributed table name is needed.
398     *
399     * @permission ohos.permission.DISTRIBUTED_DATASYNC
400     * @param { string } device - Indicates the remote device.
401     * @param { string } table - {string}: The distributed table name.
402     * @param { AsyncCallback<string> } callback
403     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
404     * @since 8
405     * @deprecated since 9
406     * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName
407     */
408    obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void;
409
410    /**
411     * Obtain distributed table name of specified remote device according to local table name.
412     * When query remote device database, distributed table name is needed.
413     *
414     * @permission ohos.permission.DISTRIBUTED_DATASYNC
415     * @param { string } device - Indicates the remote device.
416     * @param { string } table
417     * @returns { Promise<string> } {string}: The distributed table name.
418     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
419     * @since 8
420     * @deprecated since 9
421     * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName
422     */
423    obtainDistributedTableName(device: string, table: string): Promise<string>;
424
425    /**
426     * Sync data between devices.
427     *
428     * @permission ohos.permission.DISTRIBUTED_DATASYNC
429     * @param { SyncMode } mode - Indicates the remote device.
430     * @param { RdbPredicates } predicates - {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status.
431     * @param { AsyncCallback<Array<[string, number]>> } callback
432     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
433     * @since 8
434     * @deprecated since 9
435     * @useinstead ohos.data.relationalStore.RdbStore.sync
436     */
437    sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void;
438
439    /**
440     * Sync data between devices.
441     *
442     * @permission ohos.permission.DISTRIBUTED_DATASYNC
443     * @param { SyncMode } mode - Indicates the remote device.
444     * @param { RdbPredicates } predicates
445     * @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status.
446     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
447     * @since 8
448     * @deprecated since 9
449     * @useinstead ohos.data.relationalStore.RdbStore.sync
450     */
451    sync(mode: SyncMode, predicates: RdbPredicates): Promise<Array<[string, number]>>;
452
453    /**
454     * Registers an observer for the database. When data in the distributed database changes,
455     * the callback will be invoked.
456     *
457     * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'.
458     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}.
459     * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required.
460     * @param { Callback<Array<string>> } observer - {Array<string>}: The observer of data change events in the distributed database.
461     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
462     * @since 8
463     * @deprecated since 9
464     * @useinstead ohos.data.relationalStore.RdbStore.on
465     */
466    on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void;
467
468    /**
469     * Remove specified observer of specified type from the database.
470     *
471     * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'.
472     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}.
473     * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required.
474     * @param { Callback<Array<string>> } observer - {Array<string>}: The data change observer already registered.
475     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
476     * @since 8
477     * @deprecated since 9
478     * @useinstead ohos.data.relationalStore.RdbStore.off
479     */
480    off(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void;
481  }
482
483  /**
484   * Indicates possible value types
485   *
486   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
487   * @since 7
488   * @deprecated since 9
489   * @useinstead ohos.data.relationalStore.ValueType
490   */
491  type ValueType = number | string | boolean;
492
493  /**
494   * Values in buckets are stored in key-value pairs
495   *
496   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
497   * @since 7
498   * @deprecated since 9
499   * @useinstead ohos.data.relationalStore.ValuesBucket
500   */
501  type ValuesBucket = { [key: string]: ValueType | Uint8Array | null };
502
503  /**
504   * Manages relational database configurations.
505   *
506   * @interface StoreConfig
507   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
508   * @since 7
509   * @deprecated since 9
510   * @useinstead ohos.data.relationalStore.StoreConfig
511   */
512  interface StoreConfig {
513    /**
514     * Manages relational database configurations.
515     *
516     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
517     * @since 7
518     * @deprecated since 9
519     * @useinstead ohos.data.relationalStore.StoreConfig
520     */
521    name: string;
522  }
523
524  /**
525   * Manages relational database configurations.
526   *
527   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
528   * @since 7
529   * @deprecated since 9
530   * @useinstead ohos.data.relationalStore.RdbPredicates
531   */
532  class RdbPredicates {
533    /**
534     * A parameterized constructor used to create an RdbPredicates instance.
535     *
536     * @param { string } name - Indicates the table name of the database.
537     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
538     * @since 7
539     * @deprecated since 9
540     * @useinstead ohos.data.relationalStore.RdbPredicates.constructor
541     */
542    constructor(name: string);
543
544    /**
545     * Sync data between devices.
546     * When query database, this function should not be called.
547     *
548     * @param { Array<string> } devices - Indicates specified remote devices.
549     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
550     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
551     * @since 8
552     * @deprecated since 9
553     * @useinstead ohos.data.relationalStore.RdbPredicates.inDevices
554     */
555    inDevices(devices: Array<string>): RdbPredicates;
556
557    /**
558     * Specify all remote devices which connect to local device when syncing distributed database.
559     * When query database, this function should not be called.
560     *
561     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
562     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
563     * @since 8
564     * @deprecated since 9
565     * @useinstead ohos.data.relationalStore.RdbPredicates.inAllDevices
566     */
567    inAllDevices(): RdbPredicates;
568
569    /**
570     * Configure the RdbPredicates to match the field whose data type is ValueType and value is equal
571     * to a specified value.
572     * This method is similar to = of the SQL statement.
573     *
574     * @param { string } field - Indicates the column name in the database table.
575     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
576     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
577     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
578     * @since 7
579     * @deprecated since 9
580     * @useinstead ohos.data.relationalStore.RdbPredicates.equalTo
581     */
582    equalTo(field: string, value: ValueType): RdbPredicates;
583
584    /**
585     * Configure the RdbPredicates to match the field whose data type is ValueType and value is not equal to
586     * a specified value.
587     * This method is similar to != of the SQL statement.
588     *
589     * @param { string } field - Indicates the column name in the database table.
590     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
591     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
592     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
593     * @since 7
594     * @deprecated since 9
595     * @useinstead ohos.data.relationalStore.RdbPredicates.notEqualTo
596     */
597    notEqualTo(field: string, value: ValueType): RdbPredicates;
598
599    /**
600     * Adds a left parenthesis to the RdbPredicates.
601     * This method is similar to ( of the SQL statement and needs to be used together with endWrap().
602     *
603     * @returns { RdbPredicates } - The {@link RdbPredicates} with the left parenthesis.
604     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
605     * @since 7
606     * @deprecated since 9
607     * @useinstead ohos.data.relationalStore.RdbPredicates.beginWrap
608     */
609    beginWrap(): RdbPredicates;
610
611    /**
612     * Adds a right parenthesis to the RdbPredicates.
613     * This method is similar to ) of the SQL statement and needs to be used together
614     * with beginWrap().
615     *
616     * @returns { RdbPredicates } - The {@link RdbPredicates} with the right parenthesis.
617     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
618     * @since 7
619     * @deprecated since 9
620     * @useinstead ohos.data.relationalStore.RdbPredicates.endWrap
621     */
622    endWrap(): RdbPredicates;
623
624    /**
625     * Adds an or condition to the RdbPredicates.
626     * This method is similar to or of the SQL statement.
627     *
628     * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition.
629     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
630     * @since 7
631     * @deprecated since 9
632     * @useinstead ohos.data.relationalStore.RdbPredicates.or
633     */
634    or(): RdbPredicates;
635
636    /**
637     * Adds an and condition to the RdbPredicates.
638     * This method is similar to or of the SQL statement.
639     *
640     * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition.
641     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
642     * @since 7
643     * @deprecated since 9
644     * @useinstead ohos.data.relationalStore.RdbPredicates.and
645     */
646    and(): RdbPredicates;
647
648    /**
649     * Configure the RdbPredicates to match the field whose data type is string and value
650     * contains a specified value.
651     * This method is similar to contains of the SQL statement.
652     *
653     * @param { string } field - Indicates the column name in the database table.
654     * @param { string } value - Indicates the value to match with the {@link RdbPredicates}.
655     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
656     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
657     * @since 7
658     * @deprecated since 9
659     * @useinstead ohos.data.relationalStore.RdbPredicates.contains
660     */
661    contains(field: string, value: string): RdbPredicates;
662
663    /**
664     * Configure the RdbPredicates to match the field whose data type is string and value starts
665     * with a specified string.
666     * This method is similar to value% of the SQL statement.
667     *
668     * @param { string } field - Indicates the column name in the database table.
669     * @param { string } value - Indicates the value to match with the {@link RdbPredicates}.
670     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
671     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
672     * @since 7
673     * @deprecated since 9
674     * @useinstead ohos.data.relationalStore.RdbPredicates.beginsWith
675     */
676    beginsWith(field: string, value: string): RdbPredicates;
677
678    /**
679     * Configure the RdbPredicates to match the field whose data type is string and value
680     * ends with a specified string.
681     * This method is similar to %value of the SQL statement.
682     *
683     * @param { string } field - Indicates the column name in the database table.
684     * @param { string } value - Indicates the value to match with the {@link RdbPredicates}.
685     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
686     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
687     * @since 7
688     * @deprecated since 9
689     * @useinstead ohos.data.relationalStore.RdbPredicates.endsWith
690     */
691    endsWith(field: string, value: string): RdbPredicates;
692
693    /**
694     * Configure the RdbPredicates to match the fields whose value is null.
695     * This method is similar to is null of the SQL statement.
696     *
697     * @param { string } field - Indicates the column name in the database table.
698     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
699     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
700     * @since 7
701     * @deprecated since 9
702     * @useinstead ohos.data.relationalStore.RdbPredicates.isNull
703     */
704    isNull(field: string): RdbPredicates;
705
706    /**
707     * Configure the RdbPredicates to match the specified fields whose value is not null.
708     * This method is similar to is not null of the SQL statement.
709     *
710     * @param { string } field - Indicates the column name in the database table.
711     * @returns { RdbPredicates } - The {@link RdbPredicates} self.
712     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
713     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
714     * @since 7
715     * @deprecated since 9
716     * @useinstead ohos.data.relationalStore.RdbPredicates.isNotNull
717     */
718    isNotNull(field: string): RdbPredicates;
719
720    /**
721     * Configure the RdbPredicates to match the fields whose data type is string and value is
722     * similar to a specified string.
723     * This method is similar to like of the SQL statement.
724     *
725     * @param { string } field - Indicates the column name in the database table.
726     * @param { string } value - Indicates the value to match with the {@link RdbPredicates}.
727     * @returns { RdbPredicates } - The {@link RdbPredicates} that match the specified field.
728     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
729     * @since 7
730     * @deprecated since 9
731     * @useinstead ohos.data.relationalStore.RdbPredicates.like
732     */
733    like(field: string, value: string): RdbPredicates;
734
735    /**
736     * Configure RdbPredicates to match the specified field whose data type is string and the value contains
737     * a wildcard.
738     * Different from like, the input parameters of this method are case-sensitive.
739     *
740     * @param { string } field - Indicates the column name in the database table.
741     * @param { string } value - Indicates the value to match with the {@link RdbPredicates}.
742     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
743     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
744     * @since 7
745     * @deprecated since 9
746     * @useinstead ohos.data.relationalStore.RdbPredicates.glob
747     */
748    glob(field: string, value: string): RdbPredicates;
749
750    /**
751     * Configure RdbPredicates to match the specified field whose data type is string and the value contains
752     * a wildcard.
753     *
754     * @param { string } field - Indicates the column name.
755     * @param { ValueType } low - Indicates the minimum value.
756     * @param { ValueType } high - Indicates the maximum value.
757     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
758     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
759     * @since 7
760     * @deprecated since 9
761     * @useinstead ohos.data.relationalStore.RdbPredicates.between
762     */
763    between(field: string, low: ValueType, high: ValueType): RdbPredicates;
764
765    /**
766     * Configure RdbPredicates to match the specified field whose data type is int and value is
767     * out of a given range.
768     *
769     * @param { string } field - Indicates the column name in the database table.
770     * @param { ValueType } low - Indicates the minimum value.
771     * @param { ValueType } high - Indicates  the maximum value to.
772     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
773     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
774     * @since 7
775     * @deprecated since 9
776     * @useinstead ohos.data.relationalStore.RdbPredicates.notBetween
777     */
778    notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates;
779
780    /**
781     * Restricts the value of the field to be greater than the specified value.
782     *
783     * @param { string } field - Indicates the column name in the database table.
784     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
785     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
786     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
787     * @since 7
788     * @deprecated since 9
789     * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThan
790     */
791    greaterThan(field: string, value: ValueType): RdbPredicates;
792
793    /**
794     * Restricts the value of the field to be smaller than the specified value.
795     *
796     * @param { string } field - Indicates the column name in the database table.
797     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
798     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
799     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
800     * @since 7
801     * @deprecated since 9
802     * @useinstead ohos.data.relationalStore.RdbPredicates.lessThan
803     */
804    lessThan(field: string, value: ValueType): RdbPredicates;
805
806    /**
807     * Restricts the value of the field to be greater than or equal to the specified value.
808     *
809     * @param { string } field - Indicates the column name in the database table.
810     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
811     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
812     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
813     * @since 7
814     * @deprecated since 9
815     * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThanOrEqualTo
816     */
817    greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates;
818
819    /**
820     * Restricts the value of the field to be smaller than or equal to the specified value.
821     *
822     * @param { string } field - Indicates the column name in the database table.
823     * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}.
824     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
825     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
826     * @since 7
827     * @deprecated since 9
828     * @useinstead ohos.data.relationalStore.RdbPredicates.lessThanOrEqualTo
829     */
830    lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates;
831
832    /**
833     * Restricts the ascending order of the return list. When there are several orders,
834     * the one close to the head has the highest priority.
835     *
836     * @param { string } field - Indicates the column name for sorting the return list.
837     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
838     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
839     * @since 7
840     * @deprecated since 9
841     * @useinstead ohos.data.relationalStore.RdbPredicates.orderByAsc
842     */
843    orderByAsc(field: string): RdbPredicates;
844
845    /**
846     * Restricts the descending order of the return list. When there are several orders,
847     * the one close to the head has the highest priority.
848     *
849     * @param { string } field - Indicates the column name for sorting the return list.
850     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
851     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
852     * @since 7
853     * @deprecated since 9
854     * @useinstead ohos.data.relationalStore.RdbPredicates.orderByDesc
855     */
856    orderByDesc(field: string): RdbPredicates;
857
858    /**
859     * Restricts each row of the query result to be unique.
860     *
861     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
862     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
863     * @since 7
864     * @deprecated since 9
865     * @useinstead ohos.data.relationalStore.RdbPredicates.distinct
866     */
867    distinct(): RdbPredicates;
868
869    /**
870     * Restricts the max number of return records.
871     *
872     * @param { number } value - Indicates the max length of the return list.
873     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
874     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
875     * @since 7
876     * @deprecated since 9
877     * @useinstead ohos.data.relationalStore.RdbPredicates.limitAs
878     */
879    limitAs(value: number): RdbPredicates;
880
881    /**
882     * Configure RdbPredicates to specify the start position of the returned result.
883     * Use this method together with limit(int).
884     *
885     * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer.
886     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
887     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
888     * @since 7
889     * @deprecated since 9
890     * @useinstead ohos.data.relationalStore.RdbPredicates.offsetAs
891     */
892    offsetAs(rowOffset: number): RdbPredicates;
893
894    /**
895     * Configure RdbPredicates to group query results by specified columns.
896     *
897     * @param { Array<string> } fields - Indicates the specified columns by which query results are grouped.
898     * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}.
899     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
900     * @since 7
901     * @deprecated since 9
902     * @useinstead ohos.data.relationalStore.RdbPredicates.groupBy
903     */
904    groupBy(fields: Array<string>): RdbPredicates;
905
906    /**
907     * Configure RdbPredicates to specify the index column.
908     * Before using this method, you need to create an index column.
909     *
910     * @param { string } field - Indicates the name of the index column.
911     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
912     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
913     * @since 7
914     * @deprecated since 9
915     * @useinstead ohos.data.relationalStore.RdbPredicates.indexedBy
916     */
917    indexedBy(field: string): RdbPredicates;
918
919    /**
920     * Configure RdbPredicates to match the specified field whose data type is ValueType array and values
921     * are within a given range.
922     *
923     * @param { string } field - Indicates the column name in the database table.
924     * @param { Array<ValueType> } value - Indicates the values to match with {@link RdbPredicates}.
925     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
926     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
927     * @since 7
928     * @deprecated since 9
929     * @useinstead ohos.data.relationalStore.RdbPredicates.in
930     */
931    in(field: string, value: Array<ValueType>): RdbPredicates;
932
933    /**
934     * Configure RdbPredicates to match the specified field whose data type is ValueType array and values
935     * are out of a given range.
936     *
937     * @param { string } field - Indicates the column name in the database table.
938     * @param { Array<ValueType> } value - Indicates the values to match with {@link RdbPredicates}.
939     * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}.
940     * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
941     * @since 7
942     * @deprecated since 9
943     * @useinstead ohos.data.relationalStore.RdbPredicates.notIn
944     */
945    notIn(field: string, value: Array<ValueType>): RdbPredicates;
946  }
947
948  /**
949   * Configure RdbPredicates to match the specified field whose data type is ValueType array and values
950   * are out of a given range.
951   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
952   * @since 7
953   * @deprecated since 9
954   */
955  export type ResultSet = _ResultSet;
956}
957
958/**
959 * Provides methods for rdbStore create and delete.
960 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
961 * @since 7
962 * @deprecated since 9
963 */
964export default rdb;
965