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 bool g_mockGetUserTableName = true; 23 } 24 MockHasBlock(bool mockRet)25void MockHasBlock(bool mockRet) 26 { 27 g_mockHasBlockRet = mockRet; 28 } 29 MockGetString(bool mockRet)30void MockGetString(bool mockRet) 31 { 32 g_mockGetStringRet = mockRet; 33 } 34 MockGetUserTableName(bool mockRet)35void MockGetUserTableName(bool mockRet) 36 { 37 g_mockGetUserTableName = mockRet; 38 } 39 40 namespace OHOS { 41 namespace NativeRdb { HasBlock()42bool AbsSharedResultSet::HasBlock() 43 { 44 return g_mockHasBlockRet; 45 } 46 GetString(int columnIndex,std::string & value)47int AbsSharedResultSet::GetString(int columnIndex, std::string &value) 48 { 49 if (g_mockGetStringRet == false) { 50 return E_ERROR; 51 } 52 return E_OK; 53 } 54 } // namespace NativeRdb 55 } // namespace OHOS 56