DBERR to function, fixed what Emil broke

This commit is contained in:
anon 2023-08-04 16:24:07 +02:00
parent 69bf57ed38
commit 59a295a756

View File

@ -1,15 +1,5 @@
#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) \
sqlite3_prepare_v2(connection, stmt ## _template, -1, &stmt, NULL)
@ -64,6 +54,16 @@ VARDECL char const * db = DBFILE;
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
api_init(void)
{