4 * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __CTSVC_DB_INIT_H__
21 #define __CTSVC_DB_INIT_H__
24 #include "ctsvc_struct.h"
26 typedef int (*ctsvc_db_insert_record_cb)(contacts_record_h record, int *id);
27 typedef int (*ctsvc_db_get_record_cb)(int id, contacts_record_h *out_record);
28 typedef int (*ctsvc_db_update_record_cb)(contacts_record_h record);
29 typedef int (*ctsvc_db_delete_record_cb)(int id);
30 typedef int (*ctsvc_db_replace_record_cb)(contacts_record_h record, int id);
32 typedef int (*ctsvc_db_insert_records_cb)(const contacts_list_h in_list, int **ids);
33 typedef int (*ctsvc_db_update_records_cb)(const contacts_list_h in_list);
34 typedef int (*ctsvc_db_delete_records_cb)(int ids[], int count);
35 typedef int (*ctsvc_db_replace_records_cb)(const contacts_list_h in_list, int ids[],
38 typedef int (*ctsvc_db_get_all_records_cb)(int offset, int limit, contacts_list_h *out_list);
39 typedef int (*ctsvc_db_get_records_with_query_cb)(contacts_query_h query, int offset,
40 int limit, contacts_list_h *out_list);
41 typedef int (*ctsvc_db_get_count_cb)(int *out_count);
42 typedef int (*ctsvc_db_get_count_with_query_cb)(contacts_query_h query, int *out_count);
46 ctsvc_db_insert_record_cb insert_record;
47 ctsvc_db_get_record_cb get_record;
48 ctsvc_db_update_record_cb update_record;
49 ctsvc_db_delete_record_cb delete_record;
50 ctsvc_db_replace_record_cb replace_record;
51 ctsvc_db_get_all_records_cb get_all_records;
52 ctsvc_db_get_records_with_query_cb get_records_with_query;
53 ctsvc_db_insert_records_cb insert_records;
54 ctsvc_db_update_records_cb update_records;
55 ctsvc_db_delete_records_cb delete_records;
56 ctsvc_db_replace_records_cb replace_records;
57 ctsvc_db_get_count_cb get_count;
58 ctsvc_db_get_count_with_query_cb get_count_with_query;
59 } ctsvc_db_plugin_info_s;
62 int ctsvc_db_deinit();
64 int ctsvc_db_plugin_init();
65 int ctsvc_db_plugin_deinit();
67 int ctsvc_db_get_table_name(const char *view_uri, const char **out_table);
68 ctsvc_db_plugin_info_s* ctsvc_db_get_plugin_info(ctsvc_record_type_e type);
70 int ctsvc_required_read_permission(const char *view_uri);
71 int ctsvc_required_write_permission(const char *view_uri);
73 bool ctsvc_should_ab_access_control(const char *view_uri);
75 #endif /* __CTSVC_DB_INIT_H__ */