• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 RELATIONAL_STORE_IMPL_RESULTSET_FFI_H
17 #define RELATIONAL_STORE_IMPL_RESULTSET_FFI_H
18 
19 #include <memory>
20 
21 #include "ffi_remote_data.h"
22 #include "relational_store_impl_rdbpredicatesproxy.h"
23 #include "relational_store_utils.h"
24 #include "result_set.h"
25 
26 namespace OHOS {
27 namespace Relational {
28 
29 class ResultSetImpl : public OHOS::FFI::FFIData {
30 public:
GetRuntimeType()31     OHOS::FFI::RuntimeType *GetRuntimeType() override
32     {
33         return GetClassType();
34     }
35 
36     explicit ResultSetImpl(std::shared_ptr<NativeRdb::ResultSet> resultSet);
37 
38     CArrStr GetAllColumnNames();
39 
40     int32_t GetColumnCount();
41 
42     int32_t GetRowCount();
43 
44     int32_t GetRowIndex();
45 
46     bool IsAtFirstRow();
47 
48     bool IsAtLastRow();
49 
50     bool IsEnded();
51 
52     bool IsStarted();
53 
54     bool IsClosed();
55 
56     double GetDouble(int32_t columnIndex, int32_t *rtnCode);
57 
58     bool GoToRow(int32_t position, int32_t *rtnCode);
59 
60     bool GoToPreviousRow(int32_t *rtnCode);
61 
62     bool GoToLastRow(int32_t *rtnCode);
63 
64     char *GetColumnName(int32_t columnIndex, int32_t *rtnCode);
65 
66     bool IsColumnNull(int32_t columnIndex, int32_t *rtnCode);
67 
68     Asset GetAsset(int32_t columnIndex, int32_t *rtnCode);
69 
70     int32_t Close();
71 
72     int32_t GetColumnIndex(char *columnName, int32_t *rtnCode);
73 
74     char *GetString(int32_t columnIndex, int32_t *rtnCode);
75 
76     bool GoToFirstRow(int32_t *rtnCode);
77 
78     int64_t GetLong(int32_t columnIndex, int32_t *rtnCode);
79 
80     bool GoToNextRow(int32_t *rtnCode);
81 
82     CArrUI8 GetBlob(int32_t columnIndex, int32_t *rtnCode);
83 
84     bool GoTo(int32_t offset, int32_t *rtnCode);
85 
86     Assets GetAssets(int32_t columnIndex, int32_t *rtnCode);
87 
88     ValuesBucket GetRow(int32_t *rtnCode);
89 
90     ValuesBucketEx GetRowEx(int32_t *rtnCode);
91 
92     ValueTypeEx GetValue(int32_t columnIndex, int32_t* rtnCode);
93 
94     std::shared_ptr<NativeRdb::ResultSet> resultSetValue;
95 
96 private:
97     friend class OHOS::FFI::RuntimeType;
98     friend class OHOS::FFI::TypeBase;
99     static OHOS::FFI::RuntimeType *GetClassType();
100 };
101 } // namespace Relational
102 } // namespace OHOS
103 
104 #endif