tizen 2.4 release
[framework/context/context-common.git] / include / db_mgr_iface.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __CONTEXT_DB_MANAGER_INTERFACE_H__
18 #define __CONTEXT_DB_MANAGER_INTERFACE_H__
19
20 #include <sys/types.h>
21
22 namespace ctx {
23         /* Forward Declaration */
24         class json;
25         class db_listener_iface;
26
27         class db_manager_iface {
28                 public:
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 */
36
37         namespace db_manager {
38                 void set_instance(db_manager_iface* mgr);
39         }       /* namespace ctx::db_manager */
40 }       /* namespace ctx */
41
42 #endif  /* __CONTEXT_DB_MANAGER_INTERFACE_H__ */