Wrap up version 1.3.3.
[minidlna.git] / sql.h
bloba62bc51bac21fcc4b428095185e2c31f9b658c48
1 /* Reusable SQLite3 wrapper functions
3 * Project : minidlna
4 * Website : http://sourceforge.net/projects/minidlna/
5 * Author : Justin Maggard
7 * MiniDLNA media server
8 * Copyright (C) 2008-2009 Justin Maggard
10 * This file is part of MiniDLNA.
12 * MiniDLNA is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 * MiniDLNA is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __SQL_H__
25 #define __SQL_H__
27 #include <stdint.h>
28 #include <sqlite3.h>
30 #ifndef HAVE_SQLITE3_MALLOC
31 #define sqlite3_malloc(size) sqlite3_mprintf("%*s", size, "")
32 #endif
33 #ifndef HAVE_SQLITE3_PREPARE_V2
34 #define sqlite3_prepare_v2 sqlite3_prepare
35 #endif
37 int sql_exec(sqlite3 *db, const char *fmt, ...);
38 int sql_get_table(sqlite3 *db, const char *zSql, char ***pazResult, int *pnRow, int *pnColumn);
39 int sql_get_int_field(sqlite3 *db, const char *fmt, ...);
40 int64_t sql_get_int64_field(sqlite3 *db, const char *fmt, ...);
41 char * sql_get_text_field(sqlite3 *db, const char *fmt, ...);
42 int db_upgrade(sqlite3 *db);
44 #endif