1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NATIVE_RDB_ABS_RESULT_SET_H 17 #define NATIVE_RDB_ABS_RESULT_SET_H 18 19 #include <memory> 20 #include <string> 21 #include <vector> 22 #include "result_set.h" 23 24 25 namespace OHOS { 26 namespace NativeRdb { 27 class AbsResultSet : public ResultSet { 28 public: 29 AbsResultSet(); 30 virtual ~AbsResultSet(); 31 virtual int GetRowCount(int &count) override; 32 virtual int GetAllColumnNames(std::vector<std::string> &columnNames) override; 33 virtual int GetBlob(int columnIndex, std::vector<uint8_t> &blob) override; 34 virtual int GetString(int columnIndex, std::string &value) override; 35 virtual int GetInt(int columnIndex, int &value) override; 36 virtual int GetLong(int columnIndex, int64_t &value) override; 37 virtual int GetDouble(int columnIndex, double &value) override; 38 virtual int IsColumnNull(int columnIndex, bool &isNull) override; 39 virtual int GoToRow(int position) override; 40 virtual int GetColumnType(int columnIndex, ColumnType &columnType) override; 41 int GetRowIndex(int &position) const override; 42 int GoTo(int offset) override; 43 int GoToFirstRow() override; 44 int GoToLastRow() override; 45 int GoToNextRow() override; 46 int GoToPreviousRow() override; 47 int IsAtFirstRow(bool &result) const override; 48 int IsAtLastRow(bool &result) override; 49 int IsStarted(bool &result) const override; 50 int IsEnded(bool &result) override; 51 int GetColumnCount(int &count) override; 52 int GetColumnIndex(const std::string &columnName, int &columnIndex) override; 53 int GetColumnName(int columnIndex, std::string &columnName) override; 54 bool IsClosed() const override; 55 int Close() override; 56 protected: 57 // The default position of the result set 58 static const int INIT_POS = -1; 59 int rowPos; 60 // Indicates whether the result set is closed 61 bool isClosed; 62 }; 63 } // namespace NativeRdb 64 } // namespace OHOS 65 66 #endif