• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_STATEMENT_MOCK_H
17 #define OHOS_STATEMENT_MOCK_H
18 
19 #include <gmock/gmock.h>
20 
21 #include "statement.h"
22 
23 namespace OHOS::NativeRdb {
24 struct SharedBlockInfo;
25 class MockStatement : public Statement {
26 public:
27     MOCK_METHOD(int32_t, Prepare, (const std::string &sql), (override));
28     MOCK_METHOD(int32_t, Bind, (const std::vector<ValueObject> &args), (override));
29     MOCK_METHOD((std::pair<int32_t, int32_t>), Count, (), (override));
30     MOCK_METHOD(int32_t, Step, (), (override));
31     MOCK_METHOD(int32_t, Reset, (), (override));
32     MOCK_METHOD(int32_t, Finalize, (), (override));
33     MOCK_METHOD(int32_t, Execute, (const std::vector<ValueObject> &args), (override));
34     MOCK_METHOD(int32_t, Execute, (const std::vector<std::reference_wrapper<ValueObject>> &args), (override));
35     MOCK_METHOD((std::pair<int, ValueObject>), ExecuteForValue, (const std::vector<ValueObject> &args), (override));
36     MOCK_METHOD(int32_t, Changes, (), (const, override));
37     MOCK_METHOD(int64_t, LastInsertRowId, (), (const, override));
38     MOCK_METHOD(int32_t, GetColumnCount, (), (const, override));
39     MOCK_METHOD((std::pair<int32_t, std::string>), GetColumnName, (int32_t index), (const, override));
40     MOCK_METHOD((std::pair<int32_t, int32_t>), GetColumnType, (int32_t index), (const, override));
41     MOCK_METHOD((std::pair<int32_t, size_t>), GetSize, (int32_t index), (const, override));
42     MOCK_METHOD((std::pair<int32_t, ValueObject>), GetColumn, (int32_t index), (const, override));
43     MOCK_METHOD((std::pair<int32_t, std::vector<ValuesBucket>>), GetRows, (uint32_t maxCount), (override));
44     MOCK_METHOD(bool, ReadOnly, (), (const, override));
45     MOCK_METHOD(bool, SupportBlockInfo, (), (const, override));
46     MOCK_METHOD(int32_t, FillBlockInfo, (SharedBlockInfo * info), (const, override));
47     MOCK_METHOD(int, ModifyLockStatus,
48         (const std::string &table, const std::vector<std::vector<uint8_t>> &hashKeys, bool isLock), (override));
49 };
50 } // namespace OHOS::NativeRdb
51 #endif // OHOS_STATEMENT_MOCK_H
52