1 /*
2 * Copyright (c) 2023 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 #include "grd_base/grd_resultset_api.h"
16
17 #include "doc_errno.h"
18 #include "grd_api_manager.h"
19 #include "grd_base/grd_error.h"
20 #include "grd_resultset_inner.h"
21 #include "rd_log_print.h"
22
23 using namespace DocumentDB;
24 static GRD_APIInfo *GRD_ResultSetApiInfo = GetApiInfo();
25
GRD_Next(GRD_ResultSet * resultSet)26 GRD_API int32_t GRD_Next(GRD_ResultSet *resultSet)
27 {
28 if (GRD_ResultSetApiInfo->NextApi == nullptr) {
29 GLOGE("Fail to dlysm RD api symbol");
30 return GRD_INNER_ERR;
31 }
32 return GRD_ResultSetApiInfo->NextApi(resultSet);
33 }
34
GRD_GetValue(GRD_ResultSet * resultSet,char ** value)35 GRD_API int32_t GRD_GetValue(GRD_ResultSet *resultSet, char **value)
36 {
37 if (GRD_ResultSetApiInfo->GetValueApi == nullptr) {
38 GLOGE("Fail to dlysm RD api symbol");
39 return GRD_INNER_ERR;
40 }
41 return GRD_ResultSetApiInfo->GetValueApi(resultSet, value);
42 }
43
GRD_FreeValue(char * value)44 GRD_API int32_t GRD_FreeValue(char *value)
45 {
46 if (GRD_ResultSetApiInfo->FreeValueApi == nullptr) {
47 GLOGE("Fail to dlysm RD api symbol");
48 return GRD_INNER_ERR;
49 }
50 return GRD_ResultSetApiInfo->FreeValueApi(value);
51 }
52
GRD_FreeResultSet(GRD_ResultSet * resultSet)53 GRD_API int32_t GRD_FreeResultSet(GRD_ResultSet *resultSet)
54 {
55 if (GRD_ResultSetApiInfo->FreeResultSetApi == nullptr) {
56 GLOGE("Fail to dlysm RD api symbol");
57 return GRD_INNER_ERR;
58 }
59 return GRD_ResultSetApiInfo->FreeResultSetApi(resultSet);
60 }
61
GRD_Prev(GRD_ResultSet * resultSet)62 GRD_API int32_t GRD_Prev(GRD_ResultSet *resultSet)
63 {
64 if (GRD_ResultSetApiInfo->PrevApi == nullptr) {
65 GLOGE("Fail to dlysm RD api symbol");
66 return GRD_INNER_ERR;
67 }
68 return GRD_ResultSetApiInfo->PrevApi(resultSet);
69 }
70
GRD_Fetch(GRD_ResultSet * resultSet,GRD_KVItemT * key,GRD_KVItemT * value)71 GRD_API int32_t GRD_Fetch(GRD_ResultSet *resultSet, GRD_KVItemT *key, GRD_KVItemT *value)
72 {
73 if (GRD_ResultSetApiInfo->FetchApi == nullptr) {
74 GLOGE("Fail to dlysm RD api symbol");
75 return GRD_INNER_ERR;
76 }
77 return GRD_ResultSetApiInfo->FetchApi(resultSet, key, value);
78 }
79