• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "result_set_utils.h"
17 
18 namespace OHOS::RdbDataAbilityAdapter {
ResultSetUtils(std::shared_ptr<DSResultSet> dbResultSet)19 ResultSetUtils::ResultSetUtils(std::shared_ptr<DSResultSet> dbResultSet) : resultSet_(std::move(dbResultSet))
20 {
21 }
22 
GetAllColumnNames(std::vector<std::string> & columnNames)23 int ResultSetUtils::GetAllColumnNames(std::vector<std::string> &columnNames)
24 {
25     return resultSet_->GetAllColumnNames(columnNames);
26 }
27 
GetColumnCount(int & count)28 int ResultSetUtils::GetColumnCount(int &count)
29 {
30     return resultSet_->GetColumnCount(count);
31 }
32 
GetColumnType(int columnIndex,NativeRdb::ColumnType & columnType)33 int ResultSetUtils::GetColumnType(int columnIndex, NativeRdb::ColumnType &columnType)
34 {
35     DataShare::DataType dataType;
36     auto ret = resultSet_->GetDataType(columnIndex, dataType);
37     columnType = NativeRdb::ColumnType(int32_t(dataType));
38     return ret;
39 }
40 
GetColumnIndex(const std::string & columnName,int & columnIndex)41 int ResultSetUtils::GetColumnIndex(const std::string &columnName, int &columnIndex)
42 {
43     return resultSet_->GetColumnIndex(columnName, columnIndex);
44 }
45 
GetColumnName(int columnIndex,std::string & columnName)46 int ResultSetUtils::GetColumnName(int columnIndex, std::string &columnName)
47 {
48     return resultSet_->GetColumnName(columnIndex, columnName);
49 }
50 
GetRowCount(int & count)51 int ResultSetUtils::GetRowCount(int &count)
52 {
53     return resultSet_->GetRowCount(count);
54 }
55 
GetRowIndex(int & position) const56 int ResultSetUtils::GetRowIndex(int &position) const
57 {
58     return resultSet_->GetRowIndex(position);
59 }
60 
GoTo(int offset)61 int ResultSetUtils::GoTo(int offset)
62 {
63     return resultSet_->GoTo(offset);
64 }
65 
GoToRow(int position)66 int ResultSetUtils::GoToRow(int position)
67 {
68     return resultSet_->GoToRow(position);
69 }
70 
GoToFirstRow()71 int ResultSetUtils::GoToFirstRow()
72 {
73     return resultSet_->GoToFirstRow();
74 }
75 
GoToLastRow()76 int ResultSetUtils::GoToLastRow()
77 {
78     return resultSet_->GoToLastRow();
79 }
80 
GoToNextRow()81 int ResultSetUtils::GoToNextRow()
82 {
83     return resultSet_->GoToNextRow();
84 }
85 
GoToPreviousRow()86 int ResultSetUtils::GoToPreviousRow()
87 {
88     return resultSet_->GoToPreviousRow();
89 }
90 
IsEnded(bool & result)91 int ResultSetUtils::IsEnded(bool &result)
92 {
93     return resultSet_->IsEnded(result);
94 }
95 
IsStarted(bool & result) const96 int ResultSetUtils::IsStarted(bool &result) const
97 {
98     return resultSet_->IsStarted(result);
99 }
100 
IsAtFirstRow(bool & result) const101 int ResultSetUtils::IsAtFirstRow(bool &result) const
102 {
103     return resultSet_->IsAtFirstRow(result);
104 }
105 
IsAtLastRow(bool & result)106 int ResultSetUtils::IsAtLastRow(bool &result)
107 {
108     return resultSet_->IsAtLastRow(result);
109 }
110 
GetBlob(int columnIndex,std::vector<uint8_t> & blob)111 int ResultSetUtils::GetBlob(int columnIndex, std::vector<uint8_t> &blob)
112 {
113     return resultSet_->GetBlob(columnIndex, blob);
114 }
115 
GetString(int columnIndex,std::string & value)116 int ResultSetUtils::GetString(int columnIndex, std::string &value)
117 {
118     return resultSet_->GetString(columnIndex, value);
119 }
120 
GetInt(int columnIndex,int & value)121 int ResultSetUtils::GetInt(int columnIndex, int &value)
122 {
123     return resultSet_->GetInt(columnIndex, value);
124 }
125 
GetLong(int columnIndex,int64_t & value)126 int ResultSetUtils::GetLong(int columnIndex, int64_t &value)
127 {
128     return resultSet_->GetLong(columnIndex, value);
129 }
130 
GetDouble(int columnIndex,double & value)131 int ResultSetUtils::GetDouble(int columnIndex, double &value)
132 {
133     return resultSet_->GetDouble(columnIndex, value);
134 }
135 
IsColumnNull(int columnIndex,bool & isNull)136 int ResultSetUtils::IsColumnNull(int columnIndex, bool &isNull)
137 {
138     return resultSet_->IsColumnNull(columnIndex, isNull);
139 }
140 
IsClosed() const141 bool ResultSetUtils::IsClosed() const
142 {
143     return resultSet_->IsClosed();
144 }
145 
Close()146 int ResultSetUtils::Close()
147 {
148     return resultSet_->Close();
149 }
150 }
151