3 * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef __ADVENTURE_DB_H__
19 #define __ADVENTURE_DB_H__
24 extern sqlite3 *db_open(void);
25 extern void db_close(sqlite3 *db);
27 extern sqlite3_stmt *db_prepare(sqlite3 *db, const char *query);
28 extern int db_next(sqlite3 *db, sqlite3_stmt *stmt);
29 extern int db_reset(sqlite3 *db, sqlite3_stmt *stmt);
31 extern int db_bind_bool(sqlite3 *db, sqlite3_stmt *stmt, int idx, bool value);
32 extern int db_bind_int(sqlite3 *db, sqlite3_stmt *stmt, int idx, int value);
33 extern int db_bind_long(sqlite3 *db, sqlite3_stmt *stmt, int idx, long value);
34 extern int db_bind_double(sqlite3 *db, sqlite3_stmt *stmt, int idx, double value);
35 extern int db_bind_str(sqlite3 *db, sqlite3_stmt *stmt, int idx, const char *str);
37 extern bool db_get_bool(sqlite3_stmt *stmt, int index);
38 extern int db_get_int(sqlite3_stmt *stmt, int index);
39 extern int db_get_long(sqlite3_stmt *stmt, int index);
40 extern int db_get_double(sqlite3_stmt *stmt, int index);
41 extern const char *db_get_str(sqlite3_stmt *stmt, int index);
43 extern int db_finalize(sqlite3 *db, sqlite3_stmt *stmt);
44 extern int db_exec(sqlite3 *db, const char *query);
46 extern int db_begin_transaction(sqlite3 *db);
47 extern int db_end_transaction(sqlite3 *db);
49 extern int db_drop_table(sqlite3 *db);
50 extern int db_create_table(sqlite3 *db);
52 extern int db_insert_version(sqlite3 *db, int version);
53 extern int db_remove_version(sqlite3 *db, int version);
54 extern int db_update_version(sqlite3 *db, int version);
55 extern int db_count_version(sqlite3 *db);
57 extern int db_count_group(sqlite3 *db, int *count);
58 extern long db_insert_group(sqlite3 *db, const char *title, int city1, int city2, int city3, int city4, int city5);
59 extern int db_update_group(sqlite3 *db, int time, const char *title, int city1, int city2, int city3, int city4, int city5);
60 extern int db_delete_group(sqlite3 *db, int time);
62 #endif // __ADVENTURE_DB_H__