2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef QUERY_HANDLER_HH_
18 #define QUERY_HANDLER_HH_
23 #include <sys/types.h>
25 #include "abstract_db_handler.hh"
27 #include "pkgmgrinfo_basic.h"
28 #include "pkgmgrinfo_private.h"
29 #include "query_parcelable.hh"
31 namespace pkgmgr_server {
35 #define EXPORT_API __attribute__((visibility("default")))
38 class EXPORT_API QueryHandler : public AbstractDBHandler {
40 QueryHandler(uid_t uid, int pid);
42 void SetQueryArgs(std::vector<pkgmgr_common::parcel::QueryArgs> query_args);
43 bool BindString(std::string value);
44 bool BindInt(int value);
45 std::string GetString();
48 int Execute() override;
49 std::vector<pkgmgr_common::parcel::StrArgs> GetResult();
52 int ExecuteReadQuery(GList* queries, GList* args_list);
53 int ExecuteWriteQuery(GList* queries, GList* args_list);
56 std::vector<std::string> query_;
57 std::vector<pkgmgr_common::parcel::QueryArgs> query_args_;
58 std::vector<pkgmgr_common::parcel::StrArgs> result_;
61 } // namespace database
62 } // namespace pkgmgr_server
64 #endif // QUERY_HANDLER_HH_