4 * Copyright (c) 2012 - 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 __TIZEN_SOCIAL_CALENDAR_DB_H__
21 #define __TIZEN_SOCIAL_CALENDAR_DB_H__
23 #include <calendar_types.h>
34 * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_DATABASE_MODULE
39 * @brief Called when a designated view changes.
40 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
42 * @param[in] view_uri The view URI
43 * @param[in] user_data The user data passed from the callback registration function
45 * @see calendar_db_add_changed_cb()
47 typedef void (*calendar_db_changed_cb)(const char* view_uri, void* user_data);
50 * @brief Inserts a record into the calendar database.
52 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
54 * @privilege %http://tizen.org/privilege/calendar.write
56 * @param[in] record The record handle
57 * @param[out] record_id The record ID
59 * @return @c 0 on success,
60 * otherwise a negative error value
61 * @retval #CALENDAR_ERROR_NONE Successful
62 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
63 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
64 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
65 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
66 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
67 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
68 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
70 * @pre calendar_connect() should be called to open a connection to the calendar service.
72 * @see calendar_connect()
73 * @see calendar_db_update_record()
74 * @see calendar_db_delete_record()
75 * @see calendar_db_get_record()
77 int calendar_db_insert_record(calendar_record_h record, int* record_id);
80 * @brief Gets a record from the calendar database.
82 * @details This function creates a new record handle from the calendar database by the given @a record_id. \n
83 * @a record will be created and filled with record information.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
87 * @privilege %http://tizen.org/privilege/calendar.read
89 * @remarks You must release @a record using calendar_record_destroy().
91 * @param[in] view_uri The view URI of a record
92 * @param[in] record_id The record ID
93 * @param[out] record The record handle associated with the record ID
95 * @return @c 0 on success,
96 * otherwise a negative error value
97 * @retval #CALENDAR_ERROR_NONE Successful
98 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
99 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
100 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
101 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
102 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
103 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
104 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
105 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
106 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
108 * @pre calendar_connect() should be called to open a connection to the calendar service.
110 * @see calendar_connect()
111 * @see calendar_record_destroy()
113 int calendar_db_get_record(const char* view_uri, int record_id, calendar_record_h* record);
116 * @brief Updates a record in the calendar database.
118 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
120 * @privilege %http://tizen.org/privilege/calendar.write
122 * @param[in] record The record handle
124 * @return @c 0 on success,
125 * otherwise a negative error value
126 * @retval #CALENDAR_ERROR_NONE Successful
127 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
128 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
129 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
130 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
131 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
132 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
133 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
134 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
136 * @pre calendar_connect() should be called to open a connection to the calendar service.
138 * @see calendar_connect()
139 * @see calendar_db_insert_record()
140 * @see calendar_db_delete_record()
141 * @see calendar_db_get_record()
143 int calendar_db_update_record(calendar_record_h record);
146 * @brief Deletes a record from the calendar database with related child records.
148 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
150 * @privilege %http://tizen.org/privilege/calendar.write
152 * @param[in] view_uri The view URI of a record
153 * @param[in] record_id The record ID to be deleted
155 * @return @c 0 on success,
156 * otherwise a negative error value
157 * @retval #CALENDAR_ERROR_NONE Successful
158 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
159 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
160 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
161 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
162 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
163 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
164 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
165 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
167 * @pre calendar_connect() should be called to open a connection to the calendar service.
169 * @see calendar_connect()
170 * @see calendar_db_insert_record()
172 int calendar_db_delete_record(const char* view_uri, int record_id);
175 * @brief Retrieves all records as a list.
177 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
179 * @privilege %http://tizen.org/privilege/calendar.read
181 * @remarks You must release @a record_list using calendar_list_destroy().
183 * @param[in] view_uri The view URI to get records from
184 * @param[in] offset The index from which results are received
185 * @param[in] limit The maximum number of results(value 0 is used for all records)
186 * @param[out] record_list The record list
188 * @return @c 0 on success,
189 * otherwise a negative error value
190 * @retval #CALENDAR_ERROR_NONE Successful
191 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
192 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
193 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
194 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
195 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
196 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
197 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
199 * @pre calendar_connect() should be called to open a connection to the calendar service.
201 * @see calendar_connect()
202 * @see calendar_list_destroy()
204 int calendar_db_get_all_records(const char* view_uri, int offset, int limit, calendar_list_h* record_list);
207 * @brief Retrieves records using a query handle.
209 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
211 * @privilege %http://tizen.org/privilege/calendar.read
213 * @remarks You must release @a record_list using calendar_list_destroy().
215 * @param[in] query The query handle used to filter results
216 * @param[in] offset The index from which results are received
217 * @param[in] limit The maximum number of results(value 0 is used for all records)
218 * @param[out] record_list The record list
220 * @return @c 0 on success,
221 * otherwise a negative error value
222 * @retval #CALENDAR_ERROR_NONE Successful
223 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
224 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
225 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
226 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
227 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
228 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
229 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
231 * @pre calendar_connect() should be called to open a connection to the calendar service.
233 * @see calendar_connect()
234 * @see calendar_list_destroy()
236 int calendar_db_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* record_list);
239 * @brief Gets the record count of a specific view.
241 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
243 * @privilege %http://tizen.org/privilege/calendar.read
245 * @param[in] view_uri The view URI to get records from
246 * @param[out] count The number of records
248 * @return @c 0 on success,
249 * otherwise a negative error value
250 * @retval #CALENDAR_ERROR_NONE Successful
251 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
252 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
253 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
254 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
255 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
256 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
257 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
259 * @pre This function requires an open connection to the calendar service using calendar_connect2().
261 * @see calendar_connect()
263 int calendar_db_get_count(const char* view_uri, int *count);
266 * @brief Gets the record count with a query handle.
268 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
270 * @privilege %http://tizen.org/privilege/calendar.read
272 * @param[in] query The query handle used for filtering the results
273 * @param[out] count The number of records
275 * @return @c 0 on success,
276 * otherwise a negative error value
277 * @retval #CALENDAR_ERROR_NONE Successful
278 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
279 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
280 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
281 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
282 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
283 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
284 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
286 * @pre This function requires an open connection to the calendar service using calendar_connect2().
288 * @see calendar_connect2()
290 int calendar_db_get_count_with_query(calendar_query_h query, int *count);
293 * @brief Inserts multiple records into the calendar database as a batch operation.
295 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
297 * @privilege %http://tizen.org/privilege/calendar.write
299 * @param[in] record_list The record list handle
300 * @param[out] record_id_array The array of record IDs
301 * @param[out] count The number of record IDs
303 * @return @c 0 on success,
304 * otherwise a negative error value
305 * @retval #CALENDAR_ERROR_NONE Successful
306 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
307 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
308 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
309 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
310 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
311 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
312 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
313 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
315 * @pre calendar_connect() should be called to open a connection to the calendar service.
317 * @see calendar_connect()
318 * @see calendar_db_update_records()
319 * @see calendar_db_delete_records()
321 int calendar_db_insert_records(calendar_list_h record_list, int** record_id_array, int* count);
324 * @brief Updates multiple records into the calendar database as a batch operation.
326 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
328 * @privilege %http://tizen.org/privilege/calendar.write
330 * @param[in] record_list The record list handle
332 * @return @c 0 on success,
333 * otherwise a negative error value
334 * @retval #CALENDAR_ERROR_NONE Successful
335 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
336 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
337 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
338 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
339 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
340 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
341 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
342 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
344 * @pre calendar_connect() should be called to open a connection to the calendar service.
346 * @see calendar_connect()
347 * @see calendar_db_insert_records()
348 * @see calendar_db_delete_records()
350 int calendar_db_update_records(calendar_list_h record_list);
353 * @brief Deletes multiple records with related child records from the calendar database as a batch operation.
355 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
357 * @privilege %http://tizen.org/privilege/calendar.write
359 * @param[in] view_uri The view URI of the records to delete
360 * @param[in] record_id_array The record IDs to delete
361 * @param[in] count The number of records
363 * @return @c 0 on success,
364 * otherwise a negative error value
365 * @retval #CALENDAR_ERROR_NONE Successful
366 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
367 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
368 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
369 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
370 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
371 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
372 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
373 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
375 * @pre calendar_connect() should be called to open a connection to the calendar service.
377 * @see calendar_connect()
378 * @see calendar_db_insert_records()
379 * @see calendar_db_delete_records()
381 int calendar_db_delete_records(const char* view_uri, int record_id_array[], int count);
384 * @brief Gets the current calendar database version.
386 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
388 * @privilege %http://tizen.org/privilege/calendar.read
390 * @param[out] calendar_db_version The calendar database version
392 * @return @c 0 on success,
393 * otherwise a negative error value
394 * @retval #CALENDAR_ERROR_NONE Successful
395 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
396 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
397 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
398 * @retval ##CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
399 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
401 * @pre This function requires an open connection to the calendar service using calendar_connect().
403 * @see calendar_connect()
404 * @see calendar_db_get_changes_by_version()
406 int calendar_db_get_current_version(int* calendar_db_version);
409 * @brief Registers a callback function to be invoked when a record changes.
411 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
413 * @privilege %http://tizen.org/privilege/calendar.read
415 * @remarks If successive change notification produced on the view_uri are identical,
416 * then they are coalesced into a single notification if the older notification has not yet been called
417 * because default main loop is doing something.
418 * But, it means that a callback function is not called to reliably count of change.
419 * This API supports only @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_book view, @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_event view,
420 * @ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_todo view.
422 * @param[in] view_uri The view URI of the record to subscribe for change notifications
423 * @param[in] callback The callback function to register
424 * @param[in] user_data The user data to be passed to the callback function
426 * @return @c 0 on success,
427 * otherwise a negative error value
428 * @retval #CALENDAR_ERROR_NONE Successful
429 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
431 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
432 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
434 * @pre This function requires an open connection to the calendar service using calendar_connect().
435 * @post calendar_db_changed_cb() will be invoked when the designated view changes.
437 * @see calendar_connect()
438 * @see calendar_db_changed_cb()
439 * @see calendar_db_remove_changed_cb()
441 int calendar_db_add_changed_cb(const char* view_uri, calendar_db_changed_cb callback, void* user_data);
444 * @brief Unregisters a callback function.
446 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
448 * @privilege %http://tizen.org/privilege/calendar.read
450 * @param[in] view_uri The view URI of the record to subscribe for change notifications
451 * @param[in] callback The callback function to register
452 * @param[in] user_data The user data to be passed to the callback function
454 * @return @c 0 on success,
455 * otherwise a negative error value
456 * @retval #CALENDAR_ERROR_NONE Successful
457 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
458 * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
459 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
461 * @pre This function requires an open connection to the calendar service using calendar_connect().
463 * @see calendar_connect()
464 * @see calendar_db_changed_cb()
465 * @see calendar_db_add_changed_cb()
467 int calendar_db_remove_changed_cb(const char* view_uri, calendar_db_changed_cb callback, void* user_data);
470 * @brief Retrieves records with the given calendar database version.
472 * @details This function finds all the changed records since the given @a calendar_db_version.
474 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
476 * @privilege %http://tizen.org/privilege/calendar.read
478 * @remarks You must release @a change_record_list using calendar_list_destroy().
480 * @param[in] view_uri The view URI to get records from
481 * @param[in] calendar_book_id The calendar book ID to filter
482 * @param[in] calendar_db_version The calendar database version
483 * @param[out] record_list The record list
484 * @param[out] current_calendar_db_version The current calendar database version
486 * @return @c 0 on success,
487 * otherwise a negative error value
488 * @retval #CALENDAR_ERROR_NONE Successful
489 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
490 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
491 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
492 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
493 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
494 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
496 * @pre calendar_connect() should be called to open a connection to the calendar service.
498 * @see calendar_connect()
499 * @see calendar_list_destroy()
501 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);
504 * @brief Inserts a vcalendar stream into the calendar database.
506 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
508 * @privilege %http://tizen.org/privilege/calendar.write
510 * @param[in] vcalendar_stream The vcalendar stream
511 * @param[out] record_id_array The record IDs to delete
512 * @param[out] count The number of record ID arrays
514 * @return @c 0 on success,
515 * otherwise a negative error value
516 * @retval #CALENDAR_ERROR_NONE Successful
517 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
518 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
519 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
520 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
521 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
522 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
523 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
524 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
526 * @pre calendar_connect() should be called to open a connection to the calendar service.
528 * @see calendar_connect()
529 * @see calendar_db_replace_vcalendars()
531 int calendar_db_insert_vcalendars(const char* vcalendar_stream, int **record_id_array, int *count);
534 * @brief Replaces a vcalendar stream in the calendar database.
536 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
538 * @privilege %http://tizen.org/privilege/calendar.write
540 * @param[in] vcalendar_stream The vcalendar stream
541 * @param[in] record_id_array The record IDs to replace
542 * @param[in] count The number of record ID arrays
544 * @return @c 0 on success,
545 * otherwise a negative error value
546 * @retval #CALENDAR_ERROR_NONE Successful
547 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
548 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
549 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
550 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
551 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
552 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
553 * @retval #CALENDAR_ERROR_DB_RECORD_NOT_FOUND Database not found
554 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
556 * @pre This function requires an open connection to the calendar service by calendar_connect().
558 * @see calendar_connect()
559 * @see calendar_db_replace_vcalendars()
561 int calendar_db_replace_vcalendars(const char* vcalendar_stream, int *record_id_array, int count);
564 * @brief Replaces a record in the calendar database.
566 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
568 * @privilege %http://tizen.org/privilege/calendar.write
570 * @param[in] record The record handle
571 * @param[in] record_id The record ID
573 * @return @c 0 on success,
574 * otherwise a negative error value
575 * @retval #CALENDAR_ERROR_NONE Successful
576 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
577 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
578 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
579 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
580 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
581 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
582 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
584 * @pre calendar_connect() should be called to open a connection to the calendar service.
586 * @see calendar_connect()
587 * @see calendar_db_update_record()
588 * @see calendar_db_delete_record()
589 * @see calendar_db_get_record()
591 int calendar_db_replace_record(calendar_record_h record, int record_id);
594 * @brief Replaces multiple records in the calendar database as a batch operation.
596 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
598 * @privilege %http://tizen.org/privilege/calendar.write
600 * @param[in] record_list The record list handle
601 * @param[in] record_id_array The record IDs
602 * @param[in] count The number of record ID arrays
604 * @return @c 0 on success,
605 * otherwise a negative error value
606 * @retval #CALENDAR_ERROR_NONE Successful
607 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
608 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
609 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
610 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
611 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
612 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
613 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
615 * @pre calendar_connect() should be called to open a connection to the calendar service.
617 * @see calendar_connect()
618 * @see calendar_db_update_records()
619 * @see calendar_db_delete_records()
620 * @see calendar_db_replace_record()
622 int calendar_db_replace_records(calendar_list_h record_list, int *record_id_array, int count);
625 * @brief Gets the last successful change version of the database on the current connection.
627 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
629 * @privilege %http://tizen.org/privilege/calendar.read
631 * @param[out] last_change_version The calendar database version on the current connection
633 * @return @c 0 on success,
634 * otherwise a negative error value
635 * @retval #CALENDAR_ERROR_NONE Successful
636 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
637 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
639 * @pre This function requires an open connection to the calendar service using calendar_connect().
641 * @see calendar_connect()
642 * @see calendar_db_get_current_version()
644 int calendar_db_get_last_change_version(int* last_change_version);
647 * @brief Retrieves changed exception records since the given calendar database version.
648 * Exceptions are the modified or deleted instances in a recurring event.
650 * @details This function finds all the changed records since the given @a calendar_db_version.
652 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
654 * @privilege %http://tizen.org/privilege/calendar.read
656 * @remarks You must release @a change_record_list using calendar_list_destroy().
658 * @param[in] view_uri The view URI to get records from
659 * @param[in] original_event_id The original event ID
660 * @param[in] calendar_db_version The calendar database version starting from which to get records
661 * @param[out] list The record list
663 * @return @c 0 on success,
664 * otherwise a negative error value
665 * @retval #CALENDAR_ERROR_NONE Successful
666 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
667 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
668 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
669 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
670 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
672 * @pre calendar_connect() should be called to open a connection to the calendar service.
674 * @see calendar_connect()
675 * @see calendar_list_destroy()
677 int calendar_db_get_changes_exception_by_version(const char* view_uri, int original_event_id, int calendar_db_version, calendar_list_h* list);
680 * @brief Cleans the data after sync.
682 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
684 * @privilege %http://tizen.org/privilege/calendar.write
686 * @param[in] calendar_book_id The calendar book ID
687 * @param[in] calendar_db_version The calendar database version
689 * @return @c 0 on success,
690 * otherwise a negative error value
691 * @retval #CALENDAR_ERROR_NONE Successful
692 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
693 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
694 * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
695 * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied
696 * @retval #CALENDAR_ERROR_FILE_NO_SPACE File system is full
697 * @retval #CALENDAR_ERROR_IPC Unknown IPC error
698 * @retval #CALENDAR_ERROR_NO_DATA Data does not exist
700 * @pre calendar_connect() should be called to open a connection to the calendar service.
702 * @see calendar_connect()
704 int calendar_db_clean_after_sync(int calendar_book_id, int calendar_db_version);
714 #endif /* __TIZEN_SOCIAL_CALENDAR_DB_H__ */