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