2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _CALENDAR_QUERY_H_
19 #define _CALENDAR_QUERY_H_
25 #endif /* __cplusplus */
27 #define CALENDAR_DB_PATH "/opt/dbspace/.calendar-svc.db"
29 typedef sqlite3_stmt* stmt;
31 // Query results struct
34 int id; /**< Calendar id in database */
39 QUERY_GROUP_CASE = -16,
40 QUERY_NORMALIZATION_ERROR = -15,
41 QUERY_SET_LIMIT = -14, /**< For limit operation */
42 QUERY_NO_NEXT_ROW = -13, /**< No Row*/
43 QUERY_INSERT_FAIL = -12,
44 QUERY_ORDERING_FAIL = -11,
45 QUERY_STATEMENT_FAIL = -10,
46 QUERY_INVALID_ATTRIBUTE = -9,
47 QUERY_OVER_MAX_COUNT = -8, /**< memory allocation fail */
48 QUERY_OVER_MAX_PROPERTY_CLASS = -7, /**< Invalid property */
49 QUERY_NULL_PARAMETER = -6, /**< null input data */
50 QUERY_NO_RECORD = -5, /**< No Record */
51 QUERY_HANDLE_NONE, /**< No handle */
52 QUERY_INVALID_TYPE, /**< invalid value type */
53 QUERY_ALLOCATE_MEMORY_FAIL, /**< memory allocation fail */
54 QUERY_FAIL = -1, /**< fail */
55 QUERY_SUCCESS = 0, /**< no error */
56 }calendar_query_error;
58 calendar_query_error calendar_db_init();
60 calendar_query_error calendar_db_finish();
62 calendar_query_error calendar_exec_query(char* query);
64 int calendar_query_step(stmt pStmt);
66 void calendar_query_finalize(stmt pStmt);
68 int calendar_query_bind_int(stmt pStmt, int pos, int num);
70 int calendar_query_bind_double(stmt pStmt, int pos, double num);
72 int calendar_query_bind_text(stmt pStmt, int pos, char* str);
74 void calendar_query_stmt_reset(stmt stmt);
76 int calendar_query_column_int(stmt pStmt, int pos);
78 double calendar_query_column_double(stmt pStmt, int pos);
80 char* calendar_query_column_text(stmt pStmt, int pos);
82 stmt calendar_query_prepare(char *query);
86 #endif /* __cplusplus */
88 #endif // _CALENDAR_QUERY_H_