3.0 Native API reference english examination
[platform/core/pim/calendar-service.git] / include / calendar_db.h
1 /*
2  * Calendar Service
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 #ifndef __TIZEN_SOCIAL_CALENDAR_DB_H__
21 #define __TIZEN_SOCIAL_CALENDAR_DB_H__
22
23 #include <calendar_types.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @file calendar_db.h
31  */
32
33 /**
34  * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_DATABASE_MODULE
35  * @{
36  */
37
38 /**
39  * @brief Called when a designated view changes.
40  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
41  * @param[in] view_uri The view URI
42  * @param[in] user_data The user data passed from the callback registration function
43  * @see calendar_db_add_changed_cb()
44  */
45 typedef void (*calendar_db_changed_cb)(const char* view_uri, void* user_data);
46
47
48 /**
49  * @brief Inserts a record into the calendar database.
50  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
51  * @privlevel public
52  * @privilege %http://tizen.org/privilege/calendar.write
53  * @param[in] record The record handle
54  * @param[out] record_id The record ID
55  * @return @c 0 on success,
56  *         otherwise a negative error value
57  * @retval #CALENDAR_ERROR_NONE Successful
58  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
59  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
60  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
61  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
62  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
63  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
64  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
65  * @pre calendar_connect() should be called to open a connection to the calendar service.
66  * @see calendar_connect()
67  * @see calendar_db_update_record()
68  * @see calendar_db_delete_record()
69  * @see calendar_db_get_record()
70  */
71 int calendar_db_insert_record(calendar_record_h record, int* record_id);
72
73
74 /**
75  * @brief Gets a record from the calendar database.
76  * @details This function creates a new record handle from the calendar database by the given @a record_id. \n
77  *          @a record will be created and filled with record information.
78  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
79  * @privlevel public
80  * @privilege %http://tizen.org/privilege/calendar.read
81  * @remarks You must release @a record using calendar_record_destroy().
82  * @param[in] view_uri The view URI of a record
83  * @param[in] record_id The record ID
84  * @param[out] record The record handle associated with the record ID
85  * @return @c 0 on success,
86  *         otherwise a negative error value
87  * @retval #CALENDAR_ERROR_NONE Successful
88  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
89  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
90  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
91  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
92  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
93  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
94  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
95  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
96  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
97  * @pre calendar_connect() should be called to open a connection to the calendar service.
98  * @see calendar_connect()
99  * @see calendar_record_destroy()
100  */
101 int calendar_db_get_record(const char* view_uri, int record_id, calendar_record_h* record);
102
103
104 /**
105  * @brief Updates a record in the calendar database.
106  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
107  * @privlevel public
108  * @privilege %http://tizen.org/privilege/calendar.write
109  * @param[in] record The record handle
110  * @return @c 0 on success,
111  *         otherwise a negative error value
112  * @retval #CALENDAR_ERROR_NONE Successful
113  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
114  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
115  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
116  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
117  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
118  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
119  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
120  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
121  * @pre calendar_connect() should be called to open a connection to the calendar service.
122  * @see calendar_connect()
123  * @see calendar_db_insert_record()
124  * @see calendar_db_delete_record()
125  * @see calendar_db_get_record()
126  */
127 int calendar_db_update_record(calendar_record_h record);
128
129
130 /**
131  * @brief Deletes a record from the calendar database with related child records.
132  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
133  * @privlevel public
134  * @privilege %http://tizen.org/privilege/calendar.write
135  * @param[in] view_uri The view URI of a record
136  * @param[in] record_id The record ID to be deleted
137  * @return @c 0 on success,
138  *         otherwise a negative error value
139  * @retval #CALENDAR_ERROR_NONE Successful
140  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
141  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
142  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
143  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
144  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
145  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
146  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
147  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
148  * @pre calendar_connect() should be called to open a connection to the calendar service.
149  * @see calendar_connect()
150  * @see calendar_db_insert_record()
151  */
152 int calendar_db_delete_record(const char* view_uri, int record_id);
153
154
155 /**
156  * @brief Retrieves all records as a list.
157  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
158  * @privlevel public
159  * @privilege %http://tizen.org/privilege/calendar.read
160  * @remarks You must release @a record_list using calendar_list_destroy().
161  * @param[in] view_uri The view URI to get records from
162  * @param[in] offset The index from which results are received
163  * @param[in] limit The maximum number of results(value 0 is used for all records)
164  * @param[out] record_list The record list
165  * @return @c 0 on success,
166  *         otherwise a negative error value
167  * @retval #CALENDAR_ERROR_NONE Successful
168  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
169  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
170  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
171  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
172  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
173  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
174  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
175  * @pre calendar_connect() should be called to open a connection to the calendar service.
176  * @see calendar_connect()
177  * @see calendar_list_destroy()
178  */
179 int calendar_db_get_all_records(const char* view_uri, int offset, int limit, calendar_list_h* record_list);
180
181
182 /**
183  * @brief Retrieves records using a query handle.
184  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
185  * @privlevel public
186  * @privilege %http://tizen.org/privilege/calendar.read
187  * @remarks You must release @a record_list using calendar_list_destroy().
188  * @param[in] query The query handle used to filter results
189  * @param[in] offset The index from which results are received
190  * @param[in] limit The maximum number of results(value 0 is used for all records)
191  * @param[out] record_list The record list
192  * @return @c 0 on success,
193  *         otherwise a negative error value
194  * @retval #CALENDAR_ERROR_NONE Successful
195  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
196  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
197  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
198  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
199  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
200  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
201  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
202  * @pre calendar_connect() should be called to open a connection to the calendar service.
203  * @see calendar_connect()
204  * @see calendar_list_destroy()
205  */
206 int calendar_db_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* record_list);
207
208
209 /**
210  * @brief Gets the record count of a specific view.
211  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
212  * @privlevel public
213  * @privilege %http://tizen.org/privilege/calendar.read
214  * @param[in] view_uri The view URI to get records from
215  * @param[out] count The number of records
216  * @return @c 0 on success,
217  *         otherwise a negative error value
218  * @retval #CALENDAR_ERROR_NONE Successful
219  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
220  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
221  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
222  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
223  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
224  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
225  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
226  * @pre This function requires an open connection to the calendar service using calendar_connect2().
227  * @see calendar_connect()
228  */
229 int calendar_db_get_count(const char* view_uri, int *count);
230
231
232 /**
233  * @brief Gets the record count with a query handle.
234  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
235  * @privlevel public
236  * @privilege %http://tizen.org/privilege/calendar.read
237  * @param[in] query The query handle used for filtering the results
238  * @param[out] count The number of records
239  * @return @c 0 on success,
240  *         otherwise a negative error value
241  * @retval #CALENDAR_ERROR_NONE Successful
242  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
243  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
244  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
245  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
246  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
247  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
248  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
249  * @pre This function requires an open connection to the calendar service using calendar_connect2().
250  * @see calendar_connect2()
251  */
252 int calendar_db_get_count_with_query(calendar_query_h query, int *count);
253
254
255 /**
256  * @brief Inserts multiple records into the calendar database as a batch operation.
257  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
258  * @privlevel public
259  * @privilege %http://tizen.org/privilege/calendar.write
260  * @param[in] record_list The record list handle
261  * @param[out] record_id_array The array of record IDs
262  * @param[out] count The number of record IDs
263  * @return @c 0 on success,
264  *         otherwise a negative error value
265  * @retval #CALENDAR_ERROR_NONE Successful
266  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
267  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
268  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
269  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
270  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
271  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
272  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
273  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
274  * @pre calendar_connect() should be called to open a connection to the calendar service.
275  * @see calendar_connect()
276  * @see calendar_db_update_records()
277  * @see calendar_db_delete_records()
278  */
279 int calendar_db_insert_records(calendar_list_h record_list, int** record_id_array, int* count);
280
281
282 /**
283  * @brief Updates multiple records into the calendar database as a batch operation.
284  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
285  * @privlevel public
286  * @privilege %http://tizen.org/privilege/calendar.write
287  * @param[in] record_list The record list handle
288  * @return @c 0 on success,
289  *         otherwise a negative error value
290  * @retval #CALENDAR_ERROR_NONE Successful
291  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
292  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
293  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
294  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
295  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
296  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
297  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
298  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
299  * @pre calendar_connect() should be called to open a connection to the calendar service.
300  * @see calendar_connect()
301  * @see calendar_db_insert_records()
302  * @see calendar_db_delete_records()
303  */
304 int calendar_db_update_records(calendar_list_h record_list);
305
306
307 /**
308  * @brief Deletes multiple records with related child records from the calendar database as a batch operation.
309  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
310  * @privlevel public
311  * @privilege %http://tizen.org/privilege/calendar.write
312  * @param[in] view_uri The view URI of the records to delete
313  * @param[in] record_id_array The record IDs to delete
314  * @param[in] count The number of records
315  * @return @c 0 on success,
316  *         otherwise a negative error value
317  * @retval #CALENDAR_ERROR_NONE Successful
318  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
319  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
320  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
321  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
322  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
323  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
324  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
325  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
326  * @pre calendar_connect() should be called to open a connection to the calendar service.
327  * @see calendar_connect()
328  * @see calendar_db_insert_records()
329  * @see calendar_db_delete_records()
330  */
331 int calendar_db_delete_records(const char* view_uri, int record_id_array[], int count);
332
333
334 /**
335  * @brief Gets the current calendar database version.
336  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
337  * @privlevel public
338  * @privilege %http://tizen.org/privilege/calendar.read
339  * @param[out] calendar_db_version The calendar database version
340  * @return @c 0 on success,
341  *         otherwise a negative error value
342  * @retval #CALENDAR_ERROR_NONE Successful
343  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
344  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
345  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
346  * @retval ##CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
347  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
348  * @pre This function requires an open connection to the calendar service using calendar_connect().
349  * @see calendar_connect()
350  * @see calendar_db_get_changes_by_version()
351  */
352 int calendar_db_get_current_version(int* calendar_db_version);
353
354
355 /**
356  * @brief Registers a callback function to be invoked when a record changes.
357  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
358  * @privlevel public
359  * @privilege %http://tizen.org/privilege/calendar.read
360  * @remarks If successive change notification produced on the view_uri are identical,
361  *          then they are coalesced into a single notification if the older notification has not yet been called
362  *          because default main loop is doing something.
363  *          But it means that a callback function is not called to reliably count of change.
364  *          This API supports only @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_book view, @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_event view,
365  *          @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_todo view.
366  * @param[in] view_uri The view URI of the record to subscribe for change notifications
367  * @param[in] callback The callback function to register
368  * @param[in] user_data The user data to be passed to the callback function
369  * @return @c 0 on success,
370  *         otherwise a negative error value
371  * @retval #CALENDAR_ERROR_NONE Successful
372  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
373  * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
374  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
375  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
376  * @pre This function requires an open connection to the calendar service using calendar_connect().
377  * @post calendar_db_changed_cb() will be invoked when the designated view changes.
378  * @see calendar_connect()
379  * @see calendar_db_changed_cb()
380  * @see calendar_db_remove_changed_cb()
381  */
382 int calendar_db_add_changed_cb(const char* view_uri, calendar_db_changed_cb callback, void* user_data);
383
384
385 /**
386  * @brief Unregisters a callback function.
387  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
388  * @privlevel public
389  * @privilege %http://tizen.org/privilege/calendar.read
390  * @param[in] view_uri The view URI of the record to subscribe for change notifications
391  * @param[in] callback The callback function to register
392  * @param[in] user_data The user data to be passed to the callback function
393  * @return @c 0 on success,
394  *         otherwise a negative error value
395  * @retval #CALENDAR_ERROR_NONE Successful
396  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
397  * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
398  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
399  * @pre This function requires an open connection to the calendar service using calendar_connect().
400  * @see calendar_connect()
401  * @see calendar_db_changed_cb()
402  * @see calendar_db_add_changed_cb()
403  */
404 int calendar_db_remove_changed_cb(const char* view_uri, calendar_db_changed_cb callback, void* user_data);
405
406
407 /**
408  * @brief Retrieves records with the given calendar database version.
409  * @details This function finds all the changed records since the given @a calendar_db_version.
410  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
411  * @privlevel public
412  * @privilege %http://tizen.org/privilege/calendar.read
413  * @remarks You must release @a change_record_list using calendar_list_destroy().
414  * @param[in] view_uri The view URI to get records from
415  * @param[in] calendar_book_id The calendar book ID to filter
416  * @param[in] calendar_db_version The calendar database version
417  * @param[out] record_list The record list
418  * @param[out] current_calendar_db_version The current calendar database version
419  * @return @c 0 on success,
420  *         otherwise a negative error value
421  * @retval #CALENDAR_ERROR_NONE Successful
422  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
423  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
424  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
425  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
426  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
427  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
428  * @pre calendar_connect() should be called to open a connection to the calendar service.
429  * @see calendar_connect()
430  * @see calendar_list_destroy()
431  */
432 int calendar_db_get_changes_by_version(const char* view_uri, int calendar_book_id, int calendar_db_version, calendar_list_h* record_list, int *current_calendar_db_version);
433
434
435 /**
436  * @brief Inserts a vcalendar stream into the calendar database.
437  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
438  * @privlevel public
439  * @privilege %http://tizen.org/privilege/calendar.write
440  * @param[in] vcalendar_stream The vcalendar stream
441  * @param[out] record_id_array The record IDs to delete
442  * @param[out] count The number of record ID arrays
443  * @return @c 0 on success,
444  *         otherwise a negative error value
445  * @retval #CALENDAR_ERROR_NONE Successful
446  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
447  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
448  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
449  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
450  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
451  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
452  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
453  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
454  * @pre calendar_connect() should be called to open a connection to the calendar service.
455  * @see calendar_connect()
456  * @see calendar_db_replace_vcalendars()
457  */
458 int calendar_db_insert_vcalendars(const char* vcalendar_stream, int **record_id_array, int *count);
459
460
461 /**
462  * @brief Replaces a vcalendar stream in the calendar database.
463  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
464  * @privlevel public
465  * @privilege %http://tizen.org/privilege/calendar.write
466  * @param[in] vcalendar_stream The vcalendar stream
467  * @param[in] record_id_array The record IDs to replace
468  * @param[in] count The number of record ID arrays
469  * @return @c 0 on success,
470  *         otherwise a negative error value
471  * @retval #CALENDAR_ERROR_NONE Successful
472  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
473  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
474  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
475  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
476  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
477  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
478  * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
479  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
480  * @pre This function requires an open connection to the calendar service by calendar_connect().
481  * @see calendar_connect()
482  * @see calendar_db_replace_vcalendars()
483  */
484 int calendar_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array, int count);
485
486
487 /**
488  * @brief Replaces a record in the calendar database.
489  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
490  * @privlevel public
491  * @privilege %http://tizen.org/privilege/calendar.write
492  * @param[in] record The record handle
493  * @param[in] record_id The record ID
494  * @return @c 0 on success,
495  *         otherwise a negative error value
496  * @retval #CALENDAR_ERROR_NONE Successful
497  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
498  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
499  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
500  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
501  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
502  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
503  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
504  * @pre calendar_connect() should be called to open a connection to the calendar service.
505  * @see calendar_connect()
506  * @see calendar_db_update_record()
507  * @see calendar_db_delete_record()
508  * @see calendar_db_get_record()
509  */
510 int calendar_db_replace_record(calendar_record_h record, int record_id);
511
512
513 /**
514  * @brief Replaces multiple records in the calendar database as a batch operation.
515  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
516  * @privlevel public
517  * @privilege %http://tizen.org/privilege/calendar.write
518  * @param[in] record_list The record list handle
519  * @param[in] record_id_array The record IDs
520  * @param[in] count The number of record ID arrays
521  * @return @c 0 on success,
522  *         otherwise a negative error value
523  * @retval #CALENDAR_ERROR_NONE Successful
524  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
525  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
526  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
527  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
528  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
529  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
530  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
531  * @pre calendar_connect() should be called to open a connection to the calendar service.
532  * @see calendar_connect()
533  * @see calendar_db_update_records()
534  * @see calendar_db_delete_records()
535  * @see calendar_db_replace_record()
536  */
537 int calendar_db_replace_records(calendar_list_h record_list, int *record_id_array, int count);
538
539
540 /**
541  * @brief Gets the last successful change version of the database on the current connection.
542  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
543  * @privlevel public
544  * @privilege %http://tizen.org/privilege/calendar.read
545  * @param[out] last_change_version The calendar database version on the current connection
546  * @return @c 0 on success,
547  *         otherwise a negative error value
548  * @retval #CALENDAR_ERROR_NONE Successful
549  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
550  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
551  * @pre This function requires an open connection to the calendar service using calendar_connect().
552  * @see calendar_connect()
553  * @see calendar_db_get_current_version()
554  */
555 int calendar_db_get_last_change_version(int* last_change_version);
556
557
558 /**
559  * @brief Retrieves changed exception records since the given calendar database version.
560  *        Exceptions are the modified or deleted instances in a recurring event.
561  * @details This function finds all the changed records since the given @a calendar_db_version.
562  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
563  * @privlevel public
564  * @privilege %http://tizen.org/privilege/calendar.read
565  * @remarks You must release @a change_record_list using calendar_list_destroy().
566  * @param[in] view_uri The view URI to get records from
567  * @param[in] original_event_id The original event ID
568  * @param[in] calendar_db_version The calendar database version starting from which to get records
569  * @param[out] list The record list
570  * @return @c 0 on success,
571  *         otherwise a negative error value
572  * @retval #CALENDAR_ERROR_NONE Successful
573  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
574  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
575  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
576  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
577  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
578  * @pre calendar_connect() should be called to open a connection to the calendar service.
579  * @see calendar_connect()
580  * @see calendar_list_destroy()
581  */
582 int calendar_db_get_changes_exception_by_version(const char* view_uri, int original_event_id, int calendar_db_version, calendar_list_h* list);
583
584
585 /**
586  * @brief Cleans the data after sync.
587  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
588  * @privlevel public
589  * @privilege %http://tizen.org/privilege/calendar.write
590  * @param[in] calendar_book_id The calendar book ID
591  * @param[in] calendar_db_version The calendar database version
592  * @return @c 0 on success,
593  *         otherwise a negative error value
594  * @retval #CALENDAR_ERROR_NONE Successful
595  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
596  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
597  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
598  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied
599  * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
600  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
601  * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
602  * @pre calendar_connect() should be called to open a connection to the calendar service.
603  * @see calendar_connect()
604  */
605 int calendar_db_clean_after_sync(int calendar_book_id, int calendar_db_version);
606
607
608 /**
609  * @}
610  */
611
612 #ifdef __cplusplus
613 }
614 #endif
615
616 #endif /* __TIZEN_SOCIAL_CALENDAR_DB_H__ */
617