16ea96550Sopenharmony_ci/* 26ea96550Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 36ea96550Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 46ea96550Sopenharmony_ci * you may not use this file except in compliance with the License. 56ea96550Sopenharmony_ci * You may obtain a copy of the License at 66ea96550Sopenharmony_ci * 76ea96550Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 86ea96550Sopenharmony_ci * 96ea96550Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 106ea96550Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 116ea96550Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 126ea96550Sopenharmony_ci * See the License for the specific language governing permissions and 136ea96550Sopenharmony_ci * limitations under the License. 146ea96550Sopenharmony_ci */ 156ea96550Sopenharmony_ci 166ea96550Sopenharmony_ci#ifndef SECURITY_GUARD_RESULT_SET_MOCK_H 176ea96550Sopenharmony_ci#define SECURITY_GUARD_RESULT_SET_MOCK_H 186ea96550Sopenharmony_ci 196ea96550Sopenharmony_ci#include <cstdint> 206ea96550Sopenharmony_ci#include <string> 216ea96550Sopenharmony_ci 226ea96550Sopenharmony_ci#include "gtest/gtest.h" 236ea96550Sopenharmony_ci#include "gmock/gmock.h" 246ea96550Sopenharmony_ci 256ea96550Sopenharmony_cinamespace OHOS::NativeRdb { 266ea96550Sopenharmony_ciclass ResultSetInterface { 276ea96550Sopenharmony_cipublic: 286ea96550Sopenharmony_ci virtual ~ResultSetInterface() = default; 296ea96550Sopenharmony_ci virtual int GetBlob(int columnIndex, std::vector<uint8_t> &blob) = 0; 306ea96550Sopenharmony_ci virtual int GetString(int columnIndex, std::string &value) = 0; 316ea96550Sopenharmony_ci virtual int GetInt(int columnIndex, int &value) = 0; 326ea96550Sopenharmony_ci virtual int GetLong(int columnIndex, int64_t &value) = 0; 336ea96550Sopenharmony_ci virtual int GetDouble(int columnIndex, double &value) = 0; 346ea96550Sopenharmony_ci virtual int GetSize(int columnIndex, size_t &size) = 0; 356ea96550Sopenharmony_ci virtual int IsColumnNull(int columnIndex, bool &isNull) = 0; 366ea96550Sopenharmony_ci virtual int GoToRow(int position) = 0; 376ea96550Sopenharmony_ci virtual int GetAllColumnNames(std::vector<std::string> &columnNames) = 0; 386ea96550Sopenharmony_ci virtual int GetRowCount(int &count) = 0; 396ea96550Sopenharmony_ci virtual bool OnGo(int oldRowIndex, int newRowIndex) = 0; 406ea96550Sopenharmony_ci virtual int Close() = 0; 416ea96550Sopenharmony_ci virtual bool HasBlock() const = 0; 426ea96550Sopenharmony_ci virtual int GetColumnCount(int &count) = 0; 436ea96550Sopenharmony_ci virtual int GoToNextRow() = 0; 446ea96550Sopenharmony_ci}; 456ea96550Sopenharmony_ci 466ea96550Sopenharmony_ciclass ResultSet : public ResultSetInterface { 476ea96550Sopenharmony_cipublic: 486ea96550Sopenharmony_ci ResultSet() = default; 496ea96550Sopenharmony_ci ~ResultSet() override = default; 506ea96550Sopenharmony_ci MOCK_METHOD2(GetBlob, int(int columnIndex, std::vector<uint8_t> &blob)); 516ea96550Sopenharmony_ci MOCK_METHOD2(GetString, int(int columnIndex, std::string &value)); 526ea96550Sopenharmony_ci MOCK_METHOD2(GetInt, int(int columnIndex, int &value)); 536ea96550Sopenharmony_ci MOCK_METHOD2(GetLong, int(int columnIndex, int64_t &value)); 546ea96550Sopenharmony_ci MOCK_METHOD2(GetDouble, int(int columnIndex, double &value)); 556ea96550Sopenharmony_ci MOCK_METHOD2(GetSize, int(int columnIndex, size_t &size)); 566ea96550Sopenharmony_ci MOCK_METHOD2(IsColumnNull, int(int columnIndex, bool &isNull)); 576ea96550Sopenharmony_ci MOCK_METHOD1(GoToRow, int(int position)); 586ea96550Sopenharmony_ci MOCK_METHOD1(GetAllColumnNames, int(std::vector<std::string> &columnNames)); 596ea96550Sopenharmony_ci MOCK_METHOD1(GetRowCount, int(int &count)); 606ea96550Sopenharmony_ci MOCK_METHOD2(OnGo, bool(int oldRowIndex, int newRowIndex)); 616ea96550Sopenharmony_ci MOCK_METHOD0(Close, int()); 626ea96550Sopenharmony_ci MOCK_CONST_METHOD0(HasBlock, bool()); 636ea96550Sopenharmony_ci MOCK_METHOD1(GetColumnCount, int(int &count)); 646ea96550Sopenharmony_ci MOCK_METHOD0(GoToNextRow, int()); 656ea96550Sopenharmony_ci}; 666ea96550Sopenharmony_ci} // namespace OHOS::NativeRdb 676ea96550Sopenharmony_ci#endif // SECURITY_GUARD_RESULT_SET_MOCK_H