if db version is the latest, skip checking version logic
[platform/core/pim/calendar-service.git] / server / db / cal_db_plugin_instance_localtime_extended.c
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 #include <stdlib.h>
21
22 #include "cal_internal.h"
23 #include "cal_typedef.h"
24 #include "cal_view.h"
25 #include "cal_record.h"
26
27 #include "cal_db_util.h"
28 #include "cal_db.h"
29 #include "cal_db_query.h"
30 #include "cal_access_control.h"
31 #include "cal_utils.h"
32
33 static int _cal_db_instance_localtime_extended_get_all_records(int offset, int limit, calendar_list_h* out_list);
34 static int _cal_db_instance_localtime_extended_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* out_list);
35 static int _cal_db_instance_localtime_extended_get_count(int *out_count);
36 static int _cal_db_instance_localtime_extended_get_count_with_query(calendar_query_h query, int *out_count);
37
38 /*
39  * static function
40  */
41 static void _cal_db_instance_localtime_extended_get_stmt(sqlite3_stmt *stmt, calendar_record_h record);
42 static void _cal_db_instance_localtime_extended_get_property_stmt(sqlite3_stmt *stmt,
43                 unsigned int property, int *stmt_count, calendar_record_h record);
44 static void _cal_db_instance_localtime_extended_get_projection_stmt(sqlite3_stmt *stmt,
45                 const unsigned int *projection, const int projection_count,
46                 calendar_record_h record);
47
48 cal_db_plugin_cb_s cal_db_instance_localtime_extended_plugin_cb = {
49         .is_query_only = false,
50         .insert_record = NULL,
51         .get_record = NULL,
52         .update_record = NULL,
53         .delete_record = NULL,
54         .get_all_records = _cal_db_instance_localtime_extended_get_all_records,
55         .get_records_with_query = _cal_db_instance_localtime_extended_get_records_with_query,
56         .insert_records = NULL,
57         .update_records = NULL,
58         .delete_records = NULL,
59         .get_count = _cal_db_instance_localtime_extended_get_count,
60         .get_count_with_query = _cal_db_instance_localtime_extended_get_count_with_query,
61         .replace_record = NULL,
62         .replace_records = NULL
63 };
64
65 static int _cal_db_instance_localtime_extended_get_all_records(int offset, int limit, calendar_list_h* out_list)
66 {
67         int ret = 0;
68         char offsetquery[CAL_DB_SQL_MAX_LEN] = {0};
69         char limitquery[CAL_DB_SQL_MAX_LEN] = {0};
70         sqlite3_stmt *stmt = NULL;
71
72         RETV_IF(NULL == out_list, CALENDAR_ERROR_INVALID_PARAMETER);
73
74         ret = calendar_list_create(out_list);
75         RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "calendar_list_create() Fail(%d)", ret);
76
77         if (0 < offset)
78                 snprintf(offsetquery, sizeof(offsetquery), "OFFSET %d", offset);
79         if (0 < limit)
80                 snprintf(limitquery, sizeof(limitquery), "LIMIT %d", limit);
81
82         char *query_str = NULL;
83         cal_db_append_string(&query_str, "SELECT * FROM");
84         cal_db_append_string(&query_str, CAL_VIEW_TABLE_LOCALTIME_INSTANCE_EXTENDED);
85         cal_db_append_string(&query_str, limitquery);
86         cal_db_append_string(&query_str, offsetquery);
87
88         ret = cal_db_util_query_prepare(query_str, &stmt);
89         if (CALENDAR_ERROR_NONE != ret) {
90                 /* LCOV_EXCL_START */
91                 ERR("cal_db_util_query_prepare() Fail(%d)", ret);
92                 SECURE("query[%s]", query_str);
93                 calendar_list_destroy(*out_list, true);
94                 *out_list = NULL;
95                 free(query_str);
96                 return ret;
97                 /* LCOV_EXCL_STOP */
98         }
99
100         while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) {
101                 calendar_record_h record;
102                 ret = calendar_record_create(_calendar_instance_localtime_calendar_book_extended._uri, &record);
103                 if (CALENDAR_ERROR_NONE != ret) {
104                         /* LCOV_EXCL_START */
105                         calendar_list_destroy(*out_list, true);
106                         *out_list = NULL;
107                         sqlite3_finalize(stmt);
108                         CAL_FREE(query_str);
109                         return ret;
110                         /* LCOV_EXCL_STOP */
111                 }
112                 _cal_db_instance_localtime_extended_get_stmt(stmt, record);
113
114                 ret = calendar_list_add(*out_list, record);
115                 if (CALENDAR_ERROR_NONE != ret) {
116                         /* LCOV_EXCL_START */
117                         calendar_list_destroy(*out_list, true);
118                         *out_list = NULL;
119                         calendar_record_destroy(record, true);
120                         sqlite3_finalize(stmt);
121                         CAL_FREE(query_str);
122                         return ret;
123                         /* LCOV_EXCL_STOP */
124                 }
125         }
126         sqlite3_finalize(stmt);
127         CAL_FREE(query_str);
128
129         return CALENDAR_ERROR_NONE;
130 }
131
132 static int _cal_db_instance_localtime_extended_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* out_list)
133 {
134         cal_query_s *que = NULL;
135         int ret = CALENDAR_ERROR_NONE;
136         char *condition = NULL;
137         char *projection = NULL;
138         GSList *bind_text = NULL, *cursor = NULL;
139         sqlite3_stmt *stmt = NULL;
140         int i = 0;
141         char *table_name;
142
143         que = (cal_query_s *)query;
144
145         table_name = cal_strdup(CAL_VIEW_TABLE_LOCALTIME_INSTANCE_EXTENDED);
146
147         /* make filter */
148         if (que->filter) {
149                 ret = cal_db_query_create_condition(query, &condition, &bind_text);
150                 if (CALENDAR_ERROR_NONE != ret) {
151                         /* LCOV_EXCL_START */
152                         ERR("cal_db_query_create_condition() Fail(%d), ret");
153                         CAL_FREE(table_name);
154                         return ret;
155                         /* LCOV_EXCL_STOP */
156                 }
157         }
158
159         /* make: projection */
160         ret = cal_db_query_create_projection(query, &projection);
161
162         char *query_str = NULL;
163         /* query: projection */
164         if (projection) {
165                 cal_db_append_string(&query_str, "SELECT");
166                 cal_db_append_string(&query_str, projection);
167                 cal_db_append_string(&query_str, "FROM");
168                 cal_db_append_string(&query_str, table_name);
169                 CAL_FREE(projection);
170         } else {
171                 cal_db_append_string(&query_str, "SELECT * FROM");
172                 cal_db_append_string(&query_str, table_name);
173         }
174         CAL_FREE(table_name);
175
176         /* query: condition */
177         if (condition) {
178                 cal_db_append_string(&query_str, "WHERE (");
179                 cal_db_append_string(&query_str, condition);
180                 cal_db_append_string(&query_str, ")");
181         }
182
183         /* order */
184         char *order = NULL;
185         ret = cal_db_query_create_order(query, condition, &order);
186         if (order) {
187                 cal_db_append_string(&query_str, order);
188                 CAL_FREE(order);
189         }
190         CAL_FREE(condition);
191
192         /* limit, offset */
193         char buf[CAL_STR_SHORT_LEN32] = {0};
194         if (0 < limit) {
195                 snprintf(buf, sizeof(buf), "LIMIT %d", limit);
196                 cal_db_append_string(&query_str, buf);
197
198                 if (0 < offset) {
199                         snprintf(buf, sizeof(buf), "OFFSET %d", offset);
200                         cal_db_append_string(&query_str, buf);
201                 }
202         }
203
204         /* query */
205         ret = cal_db_util_query_prepare(query_str, &stmt);
206         if (CALENDAR_ERROR_NONE != ret) {
207                 /* LCOV_EXCL_START */
208                 ERR("cal_db_util_query_prepare() Fail(%d)", ret);
209                 SECURE("query[%s]", query_str);
210                 if (bind_text) {
211                         g_slist_free_full(bind_text, free);
212                         bind_text = NULL;
213                 }
214                 free(query_str);
215                 return ret;
216                 /* LCOV_EXCL_STOP */
217         }
218
219         /* bind text */
220         if (bind_text) {
221                 g_slist_length(bind_text);
222                 for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
223                         cal_db_util_stmt_bind_text(stmt, i, cursor->data);
224         }
225
226         ret = calendar_list_create(out_list);
227         if (CALENDAR_ERROR_NONE != ret) {
228                 if (bind_text) {
229                         g_slist_free_full(bind_text, free);
230                         bind_text = NULL;
231                 }
232                 /* LCOV_EXCL_START */
233                 ERR("calendar_list_create() Fail");
234                 sqlite3_finalize(stmt);
235                 CAL_FREE(query_str);
236                 return ret;
237                 /* LCOV_EXCL_STOP */
238         }
239
240         while (CAL_SQLITE_ROW == cal_db_util_stmt_step(stmt)) {
241                 calendar_record_h record;
242                 ret = calendar_record_create(que->view_uri, &record);
243                 if (CALENDAR_ERROR_NONE != ret) {
244                         /* LCOV_EXCL_START */
245                         calendar_list_destroy(*out_list, true);
246                         *out_list = NULL;
247
248                         if (bind_text) {
249                                 g_slist_free_full(bind_text, free);
250                                 bind_text = NULL;
251                         }
252                         sqlite3_finalize(stmt);
253                         CAL_FREE(query_str);
254                         return ret;
255                         /* LCOV_EXCL_STOP */
256                 }
257                 if (0 < que->projection_count) {
258                         cal_record_set_projection(record, que->projection, que->projection_count, que->property_count);
259                         _cal_db_instance_localtime_extended_get_projection_stmt(stmt, que->projection, que->projection_count, record);
260                 } else {
261                         _cal_db_instance_localtime_extended_get_stmt(stmt, record);
262                 }
263
264                 ret = calendar_list_add(*out_list, record);
265                 if (CALENDAR_ERROR_NONE != ret) {
266                         /* LCOV_EXCL_START */
267                         calendar_list_destroy(*out_list, true);
268                         *out_list = NULL;
269                         calendar_record_destroy(record, true);
270
271                         if (bind_text) {
272                                 g_slist_free_full(bind_text, free);
273                                 bind_text = NULL;
274                         }
275                         sqlite3_finalize(stmt);
276                         CAL_FREE(query_str);
277                         return ret;
278                         /* LCOV_EXCL_STOP */
279                 }
280         }
281
282         if (bind_text) {
283                 g_slist_free_full(bind_text, free);
284                 bind_text = NULL;
285         }
286
287         sqlite3_finalize(stmt);
288         CAL_FREE(query_str);
289
290         return CALENDAR_ERROR_NONE;
291 }
292
293 static int _cal_db_instance_localtime_extended_get_count(int *out_count)
294 {
295         RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
296
297         char *query_str = NULL;
298         cal_db_append_string(&query_str, "SELECT count(*) FROM");
299         cal_db_append_string(&query_str, CAL_VIEW_TABLE_LOCALTIME_INSTANCE_EXTENDED);
300
301         int ret = 0;
302         int count = 0;
303         ret = cal_db_util_query_get_first_int_result(query_str, NULL, &count);
304         if (CALENDAR_ERROR_NONE != ret) {
305                 /* LCOV_EXCL_START */
306                 ERR("cal_db_util_query_get_first_int_result() Fail");
307                 CAL_FREE(query_str);
308                 return ret;
309                 /* LCOV_EXCL_STOP */
310         }
311         DBG("count(%d) str[%s]", count, query_str);
312         CAL_FREE(query_str);
313
314         *out_count = count;
315         return CALENDAR_ERROR_NONE;
316 }
317
318 static int _cal_db_instance_localtime_extended_get_count_with_query(calendar_query_h query, int *out_count)
319 {
320         cal_query_s *que = NULL;
321         int ret = CALENDAR_ERROR_NONE;
322         char *condition = NULL;
323         char *table_name;
324         int count = 0;
325         GSList *bind_text = NULL;
326
327         que = (cal_query_s *)query;
328
329         table_name = cal_strdup(CAL_VIEW_TABLE_LOCALTIME_INSTANCE_EXTENDED);
330
331         /* make filter */
332         if (que->filter) {
333                 ret = cal_db_query_create_condition(query, &condition, &bind_text);
334                 if (CALENDAR_ERROR_NONE != ret) {
335                         /* LCOV_EXCL_START */
336                         ERR("cal_db_query_create_condition() Fail(%d), ret");
337                         CAL_FREE(table_name);
338                         return ret;
339                         /* LCOV_EXCL_STOP */
340                 }
341         }
342
343         char *query_str = NULL;
344         /* query: select */
345         cal_db_append_string(&query_str, "SELECT count(*) FROM");
346         cal_db_append_string(&query_str, table_name);
347         CAL_FREE(table_name);
348
349         /* query: condition */
350         if (condition) {
351                 cal_db_append_string(&query_str, "WHERE (");
352                 cal_db_append_string(&query_str, condition);
353                 cal_db_append_string(&query_str, ")");
354                 CAL_FREE(condition);
355         }
356
357         /* query */
358         ret = cal_db_util_query_get_first_int_result(query_str, bind_text, &count);
359         if (CALENDAR_ERROR_NONE != ret) {
360                 /* LCOV_EXCL_START */
361                 ERR("cal_db_util_query_get_first_int_result() Fail");
362                 if (bind_text) {
363                         g_slist_free_full(bind_text, free);
364                         bind_text = NULL;
365                 }
366                 CAL_FREE(query_str);
367                 return ret;
368                 /* LCOV_EXCL_STOP */
369         }
370         DBG("count(%d) str[%s]", count, query_str);
371
372         if (out_count) *out_count = count;
373
374         if (bind_text) {
375                 g_slist_free_full(bind_text, free);
376                 bind_text = NULL;
377         }
378         CAL_FREE(query_str);
379         return CALENDAR_ERROR_NONE;
380 }
381
382 static void _cal_db_instance_localtime_extended_get_stmt(sqlite3_stmt *stmt, calendar_record_h record)
383 {
384         cal_instance_localtime_extended_s* instance =  (cal_instance_localtime_extended_s*)(record);
385         const unsigned char *temp;
386         int count = 0;
387
388         instance->event_id = sqlite3_column_int(stmt, count++);
389         instance->start.type = sqlite3_column_int(stmt, count++);
390         count++; /* utime */
391         temp = sqlite3_column_text(stmt, count++);
392         if (temp) {
393                 sscanf((const char *)temp, CAL_FORMAT_LOCAL_DATETIME, &(instance->start.time.date.year),
394                                 &(instance->start.time.date.month), &(instance->start.time.date.mday),
395                                 &(instance->start.time.date.hour), &(instance->start.time.date.minute),
396                                 &(instance->start.time.date.second));
397         }
398
399         instance->end.type = sqlite3_column_int(stmt, count++);
400         count++; /* utime */
401         temp = sqlite3_column_text(stmt, count++);
402         if (temp) {
403                 sscanf((const char *)temp, CAL_FORMAT_LOCAL_DATETIME, &(instance->end.time.date.year),
404                                 &(instance->end.time.date.month), &(instance->end.time.date.mday),
405                                 &(instance->end.time.date.hour), &(instance->end.time.date.minute),
406                                 &(instance->end.time.date.second));
407         }
408
409         temp = sqlite3_column_text(stmt, count++);
410         instance->summary = cal_strdup((const char*)temp);
411
412         temp = sqlite3_column_text(stmt, count++);
413         instance->description = cal_strdup((const char*)temp);
414
415         temp = sqlite3_column_text(stmt, count++);
416         instance->location = cal_strdup((const char*)temp);
417
418         instance->busy_status = sqlite3_column_int(stmt, count++);
419
420         instance->event_status = sqlite3_column_int(stmt, count++);
421
422         instance->priority = sqlite3_column_int(stmt, count++);
423
424         instance->sensitivity = sqlite3_column_int(stmt, count++);
425
426         instance->has_rrule = sqlite3_column_int(stmt, count++);
427         if (0 < instance->has_rrule)
428                 instance->has_rrule = 1;
429
430         instance->latitude = sqlite3_column_double(stmt, count++);
431         instance->longitude = sqlite3_column_double(stmt, count++);
432         instance->has_alarm = sqlite3_column_int(stmt, count++);
433         instance->original_event_id = sqlite3_column_int(stmt, count++);
434         instance->calendar_id = sqlite3_column_int(stmt, count++);
435
436         instance->last_mod = sqlite3_column_int64(stmt, count++);
437
438         temp = sqlite3_column_text(stmt, count++);
439         instance->sync_data1 = cal_strdup((const char*)temp);
440
441         temp = sqlite3_column_text(stmt, count++);
442         instance->organizer_name = cal_strdup((const char*)temp);
443
444         temp = sqlite3_column_text(stmt, count++);
445         instance->categories = cal_strdup((const char*)temp);
446
447         instance->has_attendee = sqlite3_column_int(stmt, count++);
448
449         temp = sqlite3_column_text(stmt, count++);
450         instance->sync_data2 = cal_strdup((const char*)temp);
451
452         temp = sqlite3_column_text(stmt, count++);
453         instance->sync_data3 = cal_strdup((const char*)temp);
454
455         temp = sqlite3_column_text(stmt, count++);
456         instance->sync_data4 = cal_strdup((const char*)temp);
457
458         instance->is_allday = sqlite3_column_int(stmt, count++);
459
460         return;
461 }
462
463 static void _cal_db_instance_localtime_extended_get_property_stmt(sqlite3_stmt *stmt,
464                 unsigned int property, int *stmt_count, calendar_record_h record)
465 {
466         cal_instance_localtime_extended_s* instance =  (cal_instance_localtime_extended_s*)(record);
467         const unsigned char *temp;
468
469         switch (property) {
470         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_START:
471                 instance->start.type = CALENDAR_TIME_LOCALTIME;
472                 *stmt_count = *stmt_count+1; /* utime */
473                 *stmt_count = *stmt_count+1;
474                 temp = sqlite3_column_text(stmt, *stmt_count);
475                 if (temp) {
476                         sscanf((const char *)temp, CAL_FORMAT_LOCAL_DATETIME, &(instance->start.time.date.year),
477                                         &(instance->start.time.date.month), &(instance->start.time.date.mday),
478                                         &(instance->start.time.date.hour), &(instance->start.time.date.minute),
479                                         &(instance->start.time.date.second));
480                 }
481                 break;
482         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_END:
483                 instance->end.type = CALENDAR_TIME_LOCALTIME;
484                 *stmt_count = *stmt_count+1; /* utime */
485                 *stmt_count = *stmt_count+1;
486                 temp = sqlite3_column_text(stmt, *stmt_count);
487                 if (temp) {
488                         sscanf((const char *)temp, CAL_FORMAT_LOCAL_DATETIME, &(instance->end.time.date.year),
489                                         &(instance->end.time.date.month), &(instance->end.time.date.mday),
490                                         &(instance->end.time.date.hour), &(instance->end.time.date.minute),
491                                         &(instance->end.time.date.second));
492                 }
493                 break;
494         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SUMMARY:
495                 temp = sqlite3_column_text(stmt, *stmt_count);
496                 instance->summary = cal_strdup((const char*)temp);
497                 break;
498         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_LOCATION:
499                 temp = sqlite3_column_text(stmt, *stmt_count);
500                 instance->location = cal_strdup((const char*)temp);
501                 break;
502         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_BOOK_ID:
503                 instance->calendar_id = sqlite3_column_int(stmt, *stmt_count);
504                 break;
505         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_DESCRIPTION:
506                 temp = sqlite3_column_text(stmt, *stmt_count);
507                 instance->description = cal_strdup((const char*)temp);
508                 break;
509         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_BUSY_STATUS:
510                 instance->busy_status = sqlite3_column_int(stmt, *stmt_count);
511                 break;
512         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_EVENT_STATUS:
513                 instance->event_status = sqlite3_column_int(stmt, *stmt_count);
514                 break;
515         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_PRIORITY:
516                 instance->priority = sqlite3_column_int(stmt, *stmt_count);
517                 break;
518         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SENSITIVITY:
519                 instance->sensitivity = sqlite3_column_int(stmt, *stmt_count);
520                 break;
521         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_HAS_RRULE:
522                 instance->has_rrule = sqlite3_column_int(stmt, *stmt_count);
523                 if (0 < instance->has_rrule)
524                         instance->has_rrule = 1;
525
526                 break;
527         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_LATITUDE:
528                 instance->latitude = sqlite3_column_double(stmt, *stmt_count);
529                 break;
530         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_LONGITUDE:
531                 instance->longitude = sqlite3_column_double(stmt, *stmt_count);
532                 break;
533         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_EVENT_ID:
534                 instance->event_id = sqlite3_column_int(stmt, *stmt_count);
535                 break;
536         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_HAS_ALARM:
537                 instance->has_alarm = sqlite3_column_int(stmt, *stmt_count);
538                 break;
539         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_ORIGINAL_EVENT_ID:
540                 instance->original_event_id = sqlite3_column_int(stmt, *stmt_count);
541                 break;
542         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_LAST_MODIFIED_TIME:
543                 instance->last_mod = sqlite3_column_int64(stmt, *stmt_count);
544                 break;
545         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SYNC_DATA1:
546                 temp = sqlite3_column_text(stmt, *stmt_count);
547                 instance->sync_data1 = cal_strdup((const char*)temp);
548                 break;
549         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_ORGANIZER_NAME:
550                 temp = sqlite3_column_text(stmt, *stmt_count);
551                 instance->organizer_name = cal_strdup((const char*)temp);
552                 break;
553         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_CATEGORIES:
554                 temp = sqlite3_column_text(stmt, *stmt_count);
555                 instance->categories = cal_strdup((const char*)temp);
556                 break;
557         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_HAS_ATTENDEE:
558                 instance->has_attendee = sqlite3_column_int(stmt, *stmt_count);
559                 break;
560         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SYNC_DATA2:
561                 temp = sqlite3_column_text(stmt, *stmt_count);
562                 instance->sync_data2 = cal_strdup((const char*)temp);
563                 break;
564         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SYNC_DATA3:
565                 temp = sqlite3_column_text(stmt, *stmt_count);
566                 instance->sync_data3 = cal_strdup((const char*)temp);
567                 break;
568         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_SYNC_DATA4:
569                 temp = sqlite3_column_text(stmt, *stmt_count);
570                 instance->sync_data4 = cal_strdup((const char*)temp);
571                 break;
572         case CAL_PROPERTY_INSTANCE_LOCALTIME_EXTENDED_IS_ALLDAY:
573                 instance->is_allday = sqlite3_column_int(stmt, *stmt_count);
574                 break;
575
576         default:
577                 sqlite3_column_int(stmt, *stmt_count);
578                 break;
579         }
580
581         *stmt_count = *stmt_count+1;
582
583         return;
584 }
585
586 static void _cal_db_instance_localtime_extended_get_projection_stmt(sqlite3_stmt *stmt,
587                 const unsigned int *projection, const int projection_count,
588                 calendar_record_h record)
589 {
590         int i = 0;
591         int stmt_count = 0;
592
593         for (i = 0; i < projection_count; i++)
594                 _cal_db_instance_localtime_extended_get_property_stmt(stmt, projection[i], &stmt_count, record);
595 }