161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file The result set of database queries.
1861847f8eSopenharmony_ci * @kit ArkData
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from '../../@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * Provides methods for accessing a database result set generated by querying the database.
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @interface ResultSet
2761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
2861847f8eSopenharmony_ci * @since 7
2961847f8eSopenharmony_ci * @deprecated since 9
3061847f8eSopenharmony_ci * @useinstead ohos.data.relationalStore.ResultSet
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_ciexport interface ResultSet {
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * Obtains the names of all columns in a result set.
3561847f8eSopenharmony_ci   * The column names are returned as a string array, in which the strings are in the same order
3661847f8eSopenharmony_ci   * as the columns in the result set.
3761847f8eSopenharmony_ci   *
3861847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
3961847f8eSopenharmony_ci   * @since 7
4061847f8eSopenharmony_ci   * @deprecated since 9
4161847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.columnNames
4261847f8eSopenharmony_ci   */
4361847f8eSopenharmony_ci  columnNames: Array<string>;
4461847f8eSopenharmony_ci
4561847f8eSopenharmony_ci  /**
4661847f8eSopenharmony_ci   * Obtains the number of columns in the result set.
4761847f8eSopenharmony_ci   * The returned number is equal to the length of the string array returned by the
4861847f8eSopenharmony_ci   * columnCount method.
4961847f8eSopenharmony_ci   *
5061847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
5161847f8eSopenharmony_ci   * @since 7
5261847f8eSopenharmony_ci   * @deprecated since 9
5361847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.columnCount
5461847f8eSopenharmony_ci   */
5561847f8eSopenharmony_ci  columnCount: number;
5661847f8eSopenharmony_ci
5761847f8eSopenharmony_ci  /**
5861847f8eSopenharmony_ci   * Obtains the number of rows in the result set.
5961847f8eSopenharmony_ci   *
6061847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
6161847f8eSopenharmony_ci   * @since 7
6261847f8eSopenharmony_ci   * @deprecated since 9
6361847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.rowCount
6461847f8eSopenharmony_ci   */
6561847f8eSopenharmony_ci  rowCount: number;
6661847f8eSopenharmony_ci
6761847f8eSopenharmony_ci  /**
6861847f8eSopenharmony_ci   * Obtains the current index of the result set.
6961847f8eSopenharmony_ci   * The result set index starts from 0.
7061847f8eSopenharmony_ci   *
7161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
7261847f8eSopenharmony_ci   * @since 7
7361847f8eSopenharmony_ci   * @deprecated since 9
7461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.rowIndex
7561847f8eSopenharmony_ci   */
7661847f8eSopenharmony_ci  rowIndex: number;
7761847f8eSopenharmony_ci
7861847f8eSopenharmony_ci  /**
7961847f8eSopenharmony_ci   * Checks whether the result set is positioned at the first row.
8061847f8eSopenharmony_ci   *
8161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
8261847f8eSopenharmony_ci   * @since 7
8361847f8eSopenharmony_ci   * @deprecated since 9
8461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isAtFirstRow
8561847f8eSopenharmony_ci   */
8661847f8eSopenharmony_ci  isAtFirstRow: boolean;
8761847f8eSopenharmony_ci
8861847f8eSopenharmony_ci  /**
8961847f8eSopenharmony_ci   * Checks whether the result set is positioned at the last row.
9061847f8eSopenharmony_ci   *
9161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
9261847f8eSopenharmony_ci   * @since 7
9361847f8eSopenharmony_ci   * @deprecated since 9
9461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isAtLastRow
9561847f8eSopenharmony_ci   */
9661847f8eSopenharmony_ci  isAtLastRow: boolean;
9761847f8eSopenharmony_ci
9861847f8eSopenharmony_ci  /**
9961847f8eSopenharmony_ci   * Checks whether the result set is positioned after the last row.
10061847f8eSopenharmony_ci   *
10161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
10261847f8eSopenharmony_ci   * @since 7
10361847f8eSopenharmony_ci   * @deprecated since 9
10461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isEnded
10561847f8eSopenharmony_ci   */
10661847f8eSopenharmony_ci  isEnded: boolean;
10761847f8eSopenharmony_ci
10861847f8eSopenharmony_ci  /**
10961847f8eSopenharmony_ci   * returns whether the cursor is pointing to the position before the first
11061847f8eSopenharmony_ci   * row.
11161847f8eSopenharmony_ci   *
11261847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
11361847f8eSopenharmony_ci   * @since 7
11461847f8eSopenharmony_ci   * @deprecated since 9
11561847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isStarted
11661847f8eSopenharmony_ci   */
11761847f8eSopenharmony_ci  isStarted: boolean;
11861847f8eSopenharmony_ci
11961847f8eSopenharmony_ci  /**
12061847f8eSopenharmony_ci   * Checks whether the current result set is closed.
12161847f8eSopenharmony_ci   * If the result set is closed by calling the close method, true will be returned.
12261847f8eSopenharmony_ci   *
12361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
12461847f8eSopenharmony_ci   * @since 7
12561847f8eSopenharmony_ci   * @deprecated since 9
12661847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isClosed
12761847f8eSopenharmony_ci   */
12861847f8eSopenharmony_ci  isClosed: boolean;
12961847f8eSopenharmony_ci
13061847f8eSopenharmony_ci  /**
13161847f8eSopenharmony_ci   * Obtains the column index based on the specified column name.
13261847f8eSopenharmony_ci   * The column name is passed as an input parameter.
13361847f8eSopenharmony_ci   *
13461847f8eSopenharmony_ci   * @param { string } columnName - Indicates the name of the specified column in the result set.
13561847f8eSopenharmony_ci   * @returns { number } return the index of the specified column.
13661847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
13761847f8eSopenharmony_ci   * @since 7
13861847f8eSopenharmony_ci   * @deprecated since 9
13961847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getColumnIndex
14061847f8eSopenharmony_ci   */
14161847f8eSopenharmony_ci  getColumnIndex(columnName: string): number;
14261847f8eSopenharmony_ci
14361847f8eSopenharmony_ci  /**
14461847f8eSopenharmony_ci   * Obtains the column name based on the specified column index.
14561847f8eSopenharmony_ci   * The column index is passed as an input parameter.
14661847f8eSopenharmony_ci   *
14761847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the index of the specified column in the result set.
14861847f8eSopenharmony_ci   * @returns { string } returns the name of the specified column.
14961847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
15061847f8eSopenharmony_ci   * @since 7
15161847f8eSopenharmony_ci   * @deprecated since 9
15261847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getColumnName
15361847f8eSopenharmony_ci   */
15461847f8eSopenharmony_ci  getColumnName(columnIndex: number): string;
15561847f8eSopenharmony_ci
15661847f8eSopenharmony_ci  /**
15761847f8eSopenharmony_ci   * Go to the specified row of the result set forwards or backwards by an offset relative to its current position.
15861847f8eSopenharmony_ci   * A positive offset indicates moving backwards, and a negative offset indicates moving forwards.
15961847f8eSopenharmony_ci   *
16061847f8eSopenharmony_ci   * @param { number } offset - Indicates the offset relative to the current position.
16161847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully and does not go beyond the range;
16261847f8eSopenharmony_ci   *                   returns false otherwise.
16361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
16461847f8eSopenharmony_ci   * @since 7
16561847f8eSopenharmony_ci   * @deprecated since 9
16661847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goTo
16761847f8eSopenharmony_ci   */
16861847f8eSopenharmony_ci  goTo(offset: number): boolean;
16961847f8eSopenharmony_ci
17061847f8eSopenharmony_ci  /**
17161847f8eSopenharmony_ci   * Go to the specified row of the result set.
17261847f8eSopenharmony_ci   *
17361847f8eSopenharmony_ci   * @param { number } position - Indicates the index of the specified row, which starts from 0.
17461847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully; returns false otherwise.
17561847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
17661847f8eSopenharmony_ci   * @since 7
17761847f8eSopenharmony_ci   * @deprecated since 9
17861847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goToRow
17961847f8eSopenharmony_ci   */
18061847f8eSopenharmony_ci  goToRow(position: number): boolean;
18161847f8eSopenharmony_ci
18261847f8eSopenharmony_ci  /**
18361847f8eSopenharmony_ci   * Go to the first row of the result set.
18461847f8eSopenharmony_ci   *
18561847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully;
18661847f8eSopenharmony_ci   *                    returns false otherwise, for example, if the result set is empty.
18761847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
18861847f8eSopenharmony_ci   * @since 7
18961847f8eSopenharmony_ci   * @deprecated since 9
19061847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goToFirstRow
19161847f8eSopenharmony_ci   */
19261847f8eSopenharmony_ci  goToFirstRow(): boolean;
19361847f8eSopenharmony_ci
19461847f8eSopenharmony_ci  /**
19561847f8eSopenharmony_ci   * Go to the last row of the result set.
19661847f8eSopenharmony_ci   *
19761847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully;
19861847f8eSopenharmony_ci   *                    returns false otherwise, for example, if the result set is empty.
19961847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
20061847f8eSopenharmony_ci   * @since 7
20161847f8eSopenharmony_ci   * @deprecated since 9
20261847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goToLastRow
20361847f8eSopenharmony_ci   */
20461847f8eSopenharmony_ci  goToLastRow(): boolean;
20561847f8eSopenharmony_ci
20661847f8eSopenharmony_ci  /**
20761847f8eSopenharmony_ci   * Go to the next row of the result set.
20861847f8eSopenharmony_ci   *
20961847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully;
21061847f8eSopenharmony_ci   *                    returns false otherwise, for example, if the result set is already in the last row.
21161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
21261847f8eSopenharmony_ci   * @since 7
21361847f8eSopenharmony_ci   * @deprecated since 9
21461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goToNextRow
21561847f8eSopenharmony_ci   */
21661847f8eSopenharmony_ci  goToNextRow(): boolean;
21761847f8eSopenharmony_ci
21861847f8eSopenharmony_ci  /**
21961847f8eSopenharmony_ci   * Go to the previous row of the result set.
22061847f8eSopenharmony_ci   *
22161847f8eSopenharmony_ci   * @returns { boolean } returns true if the result set is moved successfully;
22261847f8eSopenharmony_ci   *                    returns false otherwise, for example, if the result set is already in the first row.
22361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
22461847f8eSopenharmony_ci   * @since 7
22561847f8eSopenharmony_ci   * @deprecated since 9
22661847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.goToPreviousRow
22761847f8eSopenharmony_ci   */
22861847f8eSopenharmony_ci  goToPreviousRow(): boolean;
22961847f8eSopenharmony_ci
23061847f8eSopenharmony_ci  /**
23161847f8eSopenharmony_ci   * Obtains the value of the specified column in the current row as a byte array.
23261847f8eSopenharmony_ci   * The implementation class determines whether to throw an exception if the value of the specified column
23361847f8eSopenharmony_ci   * in the current row is null or the specified column is not of the Blob type.
23461847f8eSopenharmony_ci   *
23561847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the specified column index, which starts from 0.
23661847f8eSopenharmony_ci   * @returns { Uint8Array } returns the value of the specified column as a byte array.
23761847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
23861847f8eSopenharmony_ci   * @since 7
23961847f8eSopenharmony_ci   * @deprecated since 9
24061847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getBlob
24161847f8eSopenharmony_ci   */
24261847f8eSopenharmony_ci  getBlob(columnIndex: number): Uint8Array;
24361847f8eSopenharmony_ci
24461847f8eSopenharmony_ci  /**
24561847f8eSopenharmony_ci   * Obtains the value of the specified column in the current row as string.
24661847f8eSopenharmony_ci   * The implementation class determines whether to throw an exception if the value of the specified column
24761847f8eSopenharmony_ci   * in the current row is null or the specified column is not of the string type.
24861847f8eSopenharmony_ci   *
24961847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the specified column index, which starts from 0.
25061847f8eSopenharmony_ci   * @returns { string } returns the value of the specified column as a string.
25161847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
25261847f8eSopenharmony_ci   * @since 7
25361847f8eSopenharmony_ci   * @deprecated since 9
25461847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getString
25561847f8eSopenharmony_ci   */
25661847f8eSopenharmony_ci  getString(columnIndex: number): string;
25761847f8eSopenharmony_ci
25861847f8eSopenharmony_ci  /**
25961847f8eSopenharmony_ci   * Obtains the value of the specified column in the current row as long.
26061847f8eSopenharmony_ci   * The implementation class determines whether to throw an exception if the value of the specified column
26161847f8eSopenharmony_ci   * in the current row is null, the specified column is not of the integer type.
26261847f8eSopenharmony_ci   *
26361847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the specified column index, which starts from 0.
26461847f8eSopenharmony_ci   * @returns { number } returns the value of the specified column as a long.
26561847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
26661847f8eSopenharmony_ci   * @since 7
26761847f8eSopenharmony_ci   * @deprecated since 9
26861847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getLong
26961847f8eSopenharmony_ci   */
27061847f8eSopenharmony_ci  getLong(columnIndex: number): number;
27161847f8eSopenharmony_ci
27261847f8eSopenharmony_ci  /**
27361847f8eSopenharmony_ci   * Obtains the value of the specified column in the current row as double.
27461847f8eSopenharmony_ci   * The implementation class determines whether to throw an exception if the value of the specified column
27561847f8eSopenharmony_ci   * in the current row is null, the specified column is not of the double type.
27661847f8eSopenharmony_ci   *
27761847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the specified column index, which starts from 0.
27861847f8eSopenharmony_ci   * @returns { number } returns the value of the specified column as a double.
27961847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
28061847f8eSopenharmony_ci   * @since 7
28161847f8eSopenharmony_ci   * @deprecated since 9
28261847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.getDouble
28361847f8eSopenharmony_ci   */
28461847f8eSopenharmony_ci  getDouble(columnIndex: number): number;
28561847f8eSopenharmony_ci
28661847f8eSopenharmony_ci  /**
28761847f8eSopenharmony_ci   * Checks whether the value of the specified column in the current row is null.
28861847f8eSopenharmony_ci   *
28961847f8eSopenharmony_ci   * @param { number } columnIndex - Indicates the specified column index, which starts from 0.
29061847f8eSopenharmony_ci   * @returns { boolean } returns true if the value of the specified column in the current row is null;
29161847f8eSopenharmony_ci   *                    returns false otherwise.
29261847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
29361847f8eSopenharmony_ci   * @since 7
29461847f8eSopenharmony_ci   * @deprecated since 9
29561847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.isColumnNull
29661847f8eSopenharmony_ci   */
29761847f8eSopenharmony_ci  isColumnNull(columnIndex: number): boolean;
29861847f8eSopenharmony_ci
29961847f8eSopenharmony_ci  /**
30061847f8eSopenharmony_ci   * Closes the result set.
30161847f8eSopenharmony_ci   * Calling this method on the result set will release all of its resources and makes it ineffective.
30261847f8eSopenharmony_ci   *
30361847f8eSopenharmony_ci   * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core
30461847f8eSopenharmony_ci   * @since 7
30561847f8eSopenharmony_ci   * @deprecated since 9
30661847f8eSopenharmony_ci   * @useinstead ohos.data.relationalStore.ResultSet.close
30761847f8eSopenharmony_ci   */
30861847f8eSopenharmony_ci  close(): void;
30961847f8eSopenharmony_ci}
310