2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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 __CONTEXT_DB_MANAGER_INTERFACE_H__
18 #define __CONTEXT_DB_MANAGER_INTERFACE_H__
20 #include <sys/types.h>
23 /* Forward Declaration */
25 class db_listener_iface;
27 class db_manager_iface {
29 virtual ~db_manager_iface() {}
30 virtual bool create_table(unsigned int query_id, const char* table_name, const char* columns, const char* option = NULL, db_listener_iface* listener = NULL) = 0;
31 virtual bool insert(unsigned int query_id, const char* table_name, json& record, db_listener_iface* listener = NULL) = 0;
32 virtual bool execute(unsigned int query_id, const char* query, db_listener_iface* listener) = 0;
33 virtual bool insert_sync(const char* table_name, json& record, int64_t* row_id) = 0;
34 virtual bool execute_sync(const char* query, std::vector<json>* records) = 0;
35 }; /* class db_manager */
37 namespace db_manager {
38 void set_instance(db_manager_iface* mgr);
39 } /* namespace ctx::db_manager */
42 #endif /* __CONTEXT_DB_MANAGER_INTERFACE_H__ */