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.
19 #ifndef __CTSVC_DB_QUERY_H__
20 #define __CTSVC_DB_QUERY_H__
23 #include "contacts_db_status.h"
24 #include "ctsvc_struct.h"
25 #include "ctsvc_db_sqlite.h"
27 int ctsvc_db_insert_record(contacts_record_h record, int *id);
28 int ctsvc_db_get_record(const char *view_uri, int id, contacts_record_h *out_record);
29 int ctsvc_db_update_record(contacts_record_h record);
30 int ctsvc_db_delete_record(const char *view_uri, int id);
31 int ctsvc_db_replace_record(contacts_record_h record, int id);
32 int ctsvc_db_get_all_records(const char *view_uri, int offset, int limit,
33 contacts_list_h *out_list);
34 int ctsvc_db_get_records_with_query(contacts_query_h query, int offset, int limit,
35 contacts_list_h *out_list);
36 int ctsvc_db_get_count(const char *view_uri, int *out_count);
37 int ctsvc_db_get_count_with_query(contacts_query_h query, int *out_count);
38 int ctsvc_db_get_changes_by_version(const char *view_uri, int addressbook_id,
39 int version, contacts_list_h *out_list, int *out_current_version);
40 int ctsvc_db_get_current_version(int *out_current_version);
41 int ctsvc_db_search_records(const char *view_uri, const char *keyword, int offset,
42 int limit, contacts_list_h *out_list);
43 int ctsvc_db_search_records_with_range(const char *view_uri, const char *keyword,
44 int offset, int limit, int range, contacts_list_h *out_list);
45 int ctsvc_db_search_records_with_query(contacts_query_h query, const char *keyword,
46 int offset, int limit, contacts_list_h *out_list);
47 int ctsvc_db_search_records_for_snippet(const char *view_uri,
51 const char *start_match,
52 const char *end_match,
54 contacts_list_h *out_list);
55 int ctsvc_db_search_records_with_range_for_snippet(const char *view_uri,
60 const char *start_match,
61 const char *end_match,
63 contacts_list_h *out_list);
64 int ctsvc_db_search_records_with_query_for_snippet(contacts_query_h query,
68 const char *start_match,
69 const char *end_match,
71 contacts_list_h *out_list);
72 int ctsvc_db_get_status(contacts_db_status_e *status);
73 int ctsvc_db_insert_records_with_vcard(const char *vcard_stream, int **record_id_array,
75 int ctsvc_db_replace_records_with_vcard(const char *vcard_stream, int *record_id_array,
79 int ctsvc_db_insert_records(contacts_list_h list, int **ids, int *count);
80 int ctsvc_db_update_records(contacts_list_h list);
81 int ctsvc_db_delete_records(const char *view_uri, int *ids, int count);
82 int ctsvc_db_replace_records(contacts_list_h list, int ids[], int count);
84 int ctsvc_db_make_get_records_query_stmt(ctsvc_query_s *s_query, int offset, int limit,
86 int ctsvc_db_create_set_query(contacts_record_h record, char **set, GSList **bind_text);
87 int ctsvc_db_update_record_with_set_query(const char *set, GSList *bind_text,
88 const char *table, int id);
90 void ctsvc_db_set_status(contacts_db_status_e status);
92 #endif /* __CTSVC_DB_QUERY_H__ */