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