From: Kaj-Michael Lang Date: Mon, 18 Feb 2008 21:58:59 +0000 (+0200) Subject: Handle SQLITE_DONE return value X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbfd85678ae3bf06fdec9935fdcce3f606592c88;p=mapper Handle SQLITE_DONE return value --- diff --git a/src/db.c b/src/db.c index 9bf7636..cf19118 100644 --- a/src/db.c +++ b/src/db.c @@ -93,10 +93,10 @@ db_exec_sql(sqlite3 *db, const gchar *sql) gint r; r=sqlite3_exec(db, sql, NULL, NULL, NULL); -if (r!=SQLITE_OK) - g_printerr("SQL ERROR:(%s) %s\n", sql, sqlite3_errmsg(db)); +if (r!=SQLITE_OK && r!=SQLITE_DONE) + g_printerr("SQL ERROR %d:(%s) %s\n", r, sql, sqlite3_errmsg(db)); -return (r==SQLITE_OK) ? TRUE : FALSE; +return (r==SQLITE_OK || r==SQLITE_DONE) ? TRUE : FALSE; } /** @@ -111,12 +111,12 @@ gint r; g_assert(sql); r=sqlite3_step(sql); -if (r!=SQLITE_OK) - g_printerr("SQL ERROR: %s\n", sqlite3_errmsg(db)); +if (r!=SQLITE_OK && r!=SQLITE_DONE) + g_printerr("SQL ERROR %d: %s\n", r, sqlite3_errmsg(db)); sqlite3_reset(sql); sqlite3_clear_bindings(sql); -return (r==SQLITE_OK) ? TRUE : FALSE; +return (r==SQLITE_OK || r==SQLITE_DONE) ? TRUE : FALSE; } /**