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