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 #include "cal_typedef.h"
22 #include "cal_db_util.h"
23 #include "cal_internal.h"
24 #include "calendar_errors.h"
25 #include "cal_db_instance_helper.h"
27 int cal_db_instance_helper_insert_utime_instance(int event_id, long long int s, long long int e)
30 char query[CAL_DB_SQL_MAX_LEN] = {0};
31 snprintf(query, sizeof(query), "INSERT INTO %s (event_id, dtstart_utime, dtend_utime) "
32 "VALUES (%d, %lld, %lld) ", CAL_TABLE_NORMAL_INSTANCE, event_id, s, e);
34 ret = cal_db_util_query_exec(query);
35 if (CALENDAR_ERROR_NONE != ret) {
36 ERR("cal_db_util_query_exec() Fail(%d)", ret);
37 SECURE("[%s]", query);
40 return CALENDAR_ERROR_NONE;
43 int cal_db_instance_helper_insert_localtime_instance(int event_id, const char *s, const char *e)
46 char query[CAL_DB_SQL_MAX_LEN] = {0};
47 snprintf(query, sizeof(query), "INSERT INTO %s (event_id, dtstart_datetime, dtend_datetime) "
48 "VALUES (%d, '%s', '%s') ", CAL_TABLE_ALLDAY_INSTANCE, event_id, s, e);
50 ret = cal_db_util_query_exec(query);
51 if (CALENDAR_ERROR_NONE != ret) {
52 ERR("cal_db_util_query_exec() Fail(%d)", ret);
53 SECURE("[%s]", query);
56 return CALENDAR_ERROR_NONE;