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 ABSTRACT_DB_HANDLER_HH_
18 #define ABSTRACT_DB_HANDLER_HH_
22 #include <sys/types.h>
25 namespace pkgmgr_common {
29 #define EXPORT_API __attribute__((visibility("default")))
32 class EXPORT_API AbstractDBHandler {
46 AbstractDBHandler(uid_t uid);
47 virtual ~AbstractDBHandler();
48 virtual bool Execute() = 0;
49 void SetLocale(const std::string& locale);
50 void SetDBType(DBType type);
51 void SetOpType(OperationType type);
52 OperationType GetOpType();
56 sqlite3* GetConnection();
57 std::string GetLocale();
60 std::string GetDBPath();
61 DBType db_type_ = DB_TYPE_NONE;
62 OperationType op_type_ = OPERATION_TYPE_NONE;
65 sqlite3* db_ = nullptr;
68 } // namespace database
69 } // namespace pkgmgr_common
71 #endif // ABSTRACT_DB_HANDLER_HH_