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_double(sqlite3 *db, sqlite3_stmt *stmt, int idx, double value);
34 extern int db_bind_str(sqlite3 *db, sqlite3_stmt *stmt, int idx, const char *str);
36 extern bool db_get_bool(sqlite3_stmt *stmt, int index);
37 extern int db_get_int(sqlite3_stmt *stmt, int index);
38 extern int db_get_double(sqlite3_stmt *stmt, int index);
39 extern const char *db_get_str(sqlite3_stmt *stmt, int index);
41 extern int db_finalize(sqlite3 *db, sqlite3_stmt *stmt);
42 extern int db_exec(sqlite3 *db, const char *query);
44 extern int db_begin_transaction(sqlite3 *db);
45 extern int db_end_transaction(sqlite3 *db);
47 extern int db_drop_table(sqlite3 *db);
48 extern int db_create_table(sqlite3 *db);
50 extern int db_insert_version(sqlite3 *db, int version);
51 extern int db_remove_version(sqlite3 *db, int version);
52 extern int db_update_version(sqlite3 *db, int version);
53 extern int db_count_version(sqlite3 *db);
55 extern int db_insert_login(sqlite3 *db, const char *id, const char *passwd);
56 extern int db_update_login(sqlite3 *db, const char *id, const char *passwd);
57 extern int db_remove_login(sqlite3 *db, const char *id, const char *passwd);
58 extern int db_count_login(sqlite3 *db, const char *id, const char *passwd);
60 #endif // __ADVENTURE_DB_H__