DBERR to function, fixed what Emil broke
This commit is contained in:
parent
69bf57ed38
commit
59a295a756
20
src/api.c
20
src/api.c
@ -1,15 +1,5 @@
|
|||||||
#define DBFILE "probotic_data.sqlite"
|
#define DBFILE "probotic_data.sqlite"
|
||||||
|
|
||||||
#define DBERR(l) do { \
|
|
||||||
if(l != SQLITE_OK && l != SQLITE_ROW && l != SQLITE_DONE) \
|
|
||||||
{ \
|
|
||||||
fprintf(stderr, \
|
|
||||||
"sqlite (%d): %s\n", \
|
|
||||||
sqlite3_errcode(connection), sqlite3_errmsg(connection)); \
|
|
||||||
exit(DB_ERROR); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define stmt_prepare(stmt) \
|
#define stmt_prepare(stmt) \
|
||||||
sqlite3_prepare_v2(connection, stmt ## _template, -1, &stmt, NULL)
|
sqlite3_prepare_v2(connection, stmt ## _template, -1, &stmt, NULL)
|
||||||
|
|
||||||
@ -64,6 +54,16 @@ VARDECL char const * db = DBFILE;
|
|||||||
|
|
||||||
VARDECL sqlite3 * connection = NULL;
|
VARDECL sqlite3 * connection = NULL;
|
||||||
|
|
||||||
|
DECL void DBERR(const int l){
|
||||||
|
if(l != SQLITE_OK && l != SQLITE_ROW && l != SQLITE_DONE)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"sqlite (%d): %s\n",
|
||||||
|
sqlite3_errcode(connection), sqlite3_errmsg(connection));
|
||||||
|
exit(DB_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DECL int
|
DECL int
|
||||||
api_init(void)
|
api_init(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user