From dbfd85678ae3bf06fdec9935fdcce3f606592c88 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 18 Feb 2008 23:58:59 +0200 Subject: [PATCH] Handle SQLITE_DONE return value --- src/db.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } /** -- 2.39.5