1 /*
2  * Copyright (c) 2022 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 #include "abs_shared_result_set.h"
17 #include "rdb_errno.h"
18 
19 namespace {
20     bool g_mockHasBlockRet = true;
21     bool g_mockGetStringRet = true;
22 }
23 
MockHasBlock(bool mockRet)24 void MockHasBlock(bool mockRet)
25 {
26     g_mockHasBlockRet = mockRet;
27 }
28 
MockGetString(bool mockRet)29 void MockGetString(bool mockRet)
30 {
31     g_mockGetStringRet = mockRet;
32 }
33 
34 namespace OHOS {
35 namespace NativeRdb {
HasBlock()36 bool AbsSharedResultSet::HasBlock()
37 {
38     return g_mockHasBlockRet;
39 }
40 
GetString(int columnIndex,std::string & value)41 int AbsSharedResultSet::GetString(int columnIndex, std::string &value)
42 {
43     if (g_mockGetStringRet == false) {
44         return E_ERROR;
45     }
46     return E_OK;
47 }
48 } // namespace NativeRdb
49 } // namespace OHOS
50