1 /* 2 * Copyright (c) 2023 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 OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_CURSOR_H 17 #define OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_CURSOR_H 18 #include "store/cursor.h" 19 #include "distributeddb/result_set.h" 20 namespace OHOS::DistributedRdb { 21 class RdbCursor : public DistributedData::Cursor { 22 public: 23 explicit RdbCursor(std::shared_ptr<DistributedDB::ResultSet> resultSet); 24 ~RdbCursor(); 25 int32_t GetColumnNames(std::vector<std::string> &names) const override; 26 int32_t GetColumnName(int32_t col, std::string &name) const override; 27 int32_t GetColumnType(int32_t col) const override; 28 int32_t GetCount() const override; 29 int32_t MoveToFirst() override; 30 int32_t MoveToNext() override; 31 int32_t MoveToPrev() override; 32 int32_t GetEntry(DistributedData::VBucket &entry) override; 33 int32_t GetRow(DistributedData::VBucket &data) override; 34 int32_t Get(int32_t col, DistributedData::Value &value) override; 35 int32_t Get(const std::string &col, DistributedData::Value &value) override; 36 int32_t Close() override; 37 bool IsEnd() override; 38 39 private: 40 std::shared_ptr<DistributedDB::ResultSet> resultSet_; 41 static int32_t Convert(DistributedDB::ResultSet::ColumnType columnType); 42 }; 43 } // namespace OHOS::DistributedRdb 44 #endif // OHOS_DISTRIBUTED_DATA_DATAMGR_SERVICE_RDB_CURSOR_H 45