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 } from '../../@ohos.base'; 17 18/** 19 * Provides methods for accessing a database result set generated by querying the database. 20 * 21 * @interface ResultSet 22 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 23 * @since 7 24 * @deprecated since 9 25 * @useinstead ohos.data.relationalStore.ResultSet 26 */ 27export interface ResultSet { 28 /** 29 * Obtains the names of all columns in a result set. 30 * The column names are returned as a string array, in which the strings are in the same order 31 * as the columns in the result set. 32 * 33 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 34 * @since 7 35 * @deprecated since 9 36 * @useinstead ohos.data.relationalStore.ResultSet.columnNames 37 */ 38 columnNames: Array<string>; 39 40 /** 41 * Obtains the number of columns in the result set. 42 * The returned number is equal to the length of the string array returned by the 43 * columnCount method. 44 * 45 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 46 * @since 7 47 * @deprecated since 9 48 * @useinstead ohos.data.relationalStore.ResultSet.columnCount 49 */ 50 columnCount: number; 51 52 /** 53 * Obtains the number of rows in the result set. 54 * 55 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 56 * @since 7 57 * @deprecated since 9 58 * @useinstead ohos.data.relationalStore.ResultSet.rowCount 59 */ 60 rowCount: number; 61 62 /** 63 * Obtains the current index of the result set. 64 * The result set index starts from 0. 65 * 66 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 67 * @since 7 68 * @deprecated since 9 69 * @useinstead ohos.data.relationalStore.ResultSet.rowIndex 70 */ 71 rowIndex: number; 72 73 /** 74 * Checks whether the result set is positioned at the first row. 75 * 76 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 77 * @since 7 78 * @deprecated since 9 79 * @useinstead ohos.data.relationalStore.ResultSet.isAtFirstRow 80 */ 81 isAtFirstRow: boolean; 82 83 /** 84 * Checks whether the result set is positioned at the last row. 85 * 86 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 87 * @since 7 88 * @deprecated since 9 89 * @useinstead ohos.data.relationalStore.ResultSet.isAtLastRow 90 */ 91 isAtLastRow: boolean; 92 93 /** 94 * Checks whether the result set is positioned after the last row. 95 * 96 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 97 * @since 7 98 * @deprecated since 9 99 * @useinstead ohos.data.relationalStore.ResultSet.isEnded 100 */ 101 isEnded: boolean; 102 103 /** 104 * returns whether the cursor is pointing to the position before the first 105 * row. 106 * 107 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 108 * @since 7 109 * @deprecated since 9 110 * @useinstead ohos.data.relationalStore.ResultSet.isStarted 111 */ 112 isStarted: boolean; 113 114 /** 115 * Checks whether the current result set is closed. 116 * If the result set is closed by calling the close method, true will be returned. 117 * 118 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 119 * @since 7 120 * @deprecated since 9 121 * @useinstead ohos.data.relationalStore.ResultSet.isClosed 122 */ 123 isClosed: boolean; 124 125 /** 126 * Obtains the column index based on the specified column name. 127 * The column name is passed as an input parameter. 128 * 129 * @param { string } columnName - Indicates the name of the specified column in the result set. 130 * @returns { number } return the index of the specified column. 131 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 132 * @since 7 133 * @deprecated since 9 134 * @useinstead ohos.data.relationalStore.ResultSet.getColumnIndex 135 */ 136 getColumnIndex(columnName: string): number; 137 138 /** 139 * Obtains the column name based on the specified column index. 140 * The column index is passed as an input parameter. 141 * 142 * @param { number } columnIndex - Indicates the index of the specified column in the result set. 143 * @returns { string } returns the name of the specified column. 144 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 145 * @since 7 146 * @deprecated since 9 147 * @useinstead ohos.data.relationalStore.ResultSet.getColumnName 148 */ 149 getColumnName(columnIndex: number): string; 150 151 /** 152 * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. 153 * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. 154 * 155 * @param { number } offset - Indicates the offset relative to the current position. 156 * @returns { boolean } returns true if the result set is moved successfully and does not go beyond the range; 157 * returns false otherwise. 158 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 159 * @since 7 160 * @deprecated since 9 161 * @useinstead ohos.data.relationalStore.ResultSet.goTo 162 */ 163 goTo(offset: number): boolean; 164 165 /** 166 * Go to the specified row of the result set. 167 * 168 * @param { number } position - Indicates the index of the specified row, which starts from 0. 169 * @returns { boolean } returns true if the result set is moved successfully; returns false otherwise. 170 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 171 * @since 7 172 * @deprecated since 9 173 * @useinstead ohos.data.relationalStore.ResultSet.goToRow 174 */ 175 goToRow(position: number): boolean; 176 177 /** 178 * Go to the first row of the result set. 179 * 180 * @returns { boolean } returns true if the result set is moved successfully; 181 * returns false otherwise, for example, if the result set is empty. 182 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 183 * @since 7 184 * @deprecated since 9 185 * @useinstead ohos.data.relationalStore.ResultSet.goToFirstRow 186 */ 187 goToFirstRow(): boolean; 188 189 /** 190 * Go to the last row of the result set. 191 * 192 * @returns { boolean } returns true if the result set is moved successfully; 193 * returns false otherwise, for example, if the result set is empty. 194 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 195 * @since 7 196 * @deprecated since 9 197 * @useinstead ohos.data.relationalStore.ResultSet.goToLastRow 198 */ 199 goToLastRow(): boolean; 200 201 /** 202 * Go to the next row of the result set. 203 * 204 * @returns { boolean } returns true if the result set is moved successfully; 205 * returns false otherwise, for example, if the result set is already in the last row. 206 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 207 * @since 7 208 * @deprecated since 9 209 * @useinstead ohos.data.relationalStore.ResultSet.goToNextRow 210 */ 211 goToNextRow(): boolean; 212 213 /** 214 * Go to the previous row of the result set. 215 * 216 * @returns { boolean } returns true if the result set is moved successfully; 217 * returns false otherwise, for example, if the result set is already in the first row. 218 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 219 * @since 7 220 * @deprecated since 9 221 * @useinstead ohos.data.relationalStore.ResultSet.goToPreviousRow 222 */ 223 goToPreviousRow(): boolean; 224 225 /** 226 * Obtains the value of the specified column in the current row as a byte array. 227 * The implementation class determines whether to throw an exception if the value of the specified column 228 * in the current row is null or the specified column is not of the Blob type. 229 * 230 * @param { number } columnIndex - Indicates the specified column index, which starts from 0. 231 * @returns { Uint8Array } returns the value of the specified column as a byte array. 232 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 233 * @since 7 234 * @deprecated since 9 235 * @useinstead ohos.data.relationalStore.ResultSet.getBlob 236 */ 237 getBlob(columnIndex: number): Uint8Array; 238 239 /** 240 * Obtains the value of the specified column in the current row as string. 241 * The implementation class determines whether to throw an exception if the value of the specified column 242 * in the current row is null or the specified column is not of the string type. 243 * 244 * @param { number } columnIndex - Indicates the specified column index, which starts from 0. 245 * @returns { string } returns the value of the specified column as a string. 246 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 247 * @since 7 248 * @deprecated since 9 249 * @useinstead ohos.data.relationalStore.ResultSet.getString 250 */ 251 getString(columnIndex: number): string; 252 253 /** 254 * Obtains the value of the specified column in the current row as long. 255 * The implementation class determines whether to throw an exception if the value of the specified column 256 * in the current row is null, the specified column is not of the integer type. 257 * 258 * @param { number } columnIndex - Indicates the specified column index, which starts from 0. 259 * @returns { number } returns the value of the specified column as a long. 260 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 261 * @since 7 262 * @deprecated since 9 263 * @useinstead ohos.data.relationalStore.ResultSet.getLong 264 */ 265 getLong(columnIndex: number): number; 266 267 /** 268 * Obtains the value of the specified column in the current row as double. 269 * The implementation class determines whether to throw an exception if the value of the specified column 270 * in the current row is null, the specified column is not of the double type. 271 * 272 * @param { number } columnIndex - Indicates the specified column index, which starts from 0. 273 * @returns { number } returns the value of the specified column as a double. 274 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 275 * @since 7 276 * @deprecated since 9 277 * @useinstead ohos.data.relationalStore.ResultSet.getDouble 278 */ 279 getDouble(columnIndex: number): number; 280 281 /** 282 * Checks whether the value of the specified column in the current row is null. 283 * 284 * @param { number } columnIndex - Indicates the specified column index, which starts from 0. 285 * @returns { boolean } returns true if the value of the specified column in the current row is null; 286 * returns false otherwise. 287 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 288 * @since 7 289 * @deprecated since 9 290 * @useinstead ohos.data.relationalStore.ResultSet.isColumnNull 291 */ 292 isColumnNull(columnIndex: number): boolean; 293 294 /** 295 * Closes the result set. 296 * Calling this method on the result set will release all of its resources and makes it ineffective. 297 * 298 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core 299 * @since 7 300 * @deprecated since 9 301 * @useinstead ohos.data.relationalStore.ResultSet.close 302 */ 303 close(): void; 304} 305