From: Christian Grothoff Date: Sat, 16 Jul 2011 20:50:15 +0000 (+0000) Subject: checkret X-Git-Tag: initial-import-from-subversion-38251~17787 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a2f39db8185a9906c3eb0e0d5784cf4f505bee88;p=oweals%2Fgnunet.git checkret --- diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index eb24f5423..fd451e2b4 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c @@ -203,9 +203,15 @@ sqlite_plugin_get (void *cls, sqlite3_errmsg (plugin->dbh)); return 0; } - if (GNUNET_OK != - sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), - SQLITE_TRANSIENT)) + ntime = (int64_t) now.abs_value; + GNUNET_assert (ntime >= 0); + if ( (SQLITE_OK != + sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), + SQLITE_TRANSIENT)) || + (SQLITE_OK != + sqlite3_bind_int (stmt, 2, type)) || + (SQLITE_OK != + sqlite3_bind_int64 (stmt, 3, now.abs_value)) ) { LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, @@ -213,10 +219,7 @@ sqlite_plugin_get (void *cls, sqlite3_finalize (stmt); return 0; } - sqlite3_bind_int (stmt, 2, type); - ntime = (int64_t) now.abs_value; - GNUNET_assert (ntime >= 0); - sqlite3_bind_int64 (stmt, 3, now.abs_value); + if (SQLITE_ROW != sqlite3_step (stmt)) { LOG_SQLITE (plugin->dbh, @@ -247,10 +250,20 @@ sqlite_plugin_get (void *cls, sqlite3_errmsg (plugin->dbh)); return cnt; } - sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), - SQLITE_TRANSIENT); - sqlite3_bind_int (stmt, 2, type); - sqlite3_bind_int64 (stmt, 3, now.abs_value); + if ( (SQLITE_OK != + sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), + SQLITE_TRANSIENT)) || + (SQLITE_OK != + sqlite3_bind_int (stmt, 2, type)) || + (SQLITE_OK != + sqlite3_bind_int64 (stmt, 3, now.abs_value)) ) + { + LOG_SQLITE (plugin->dbh, + GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, + "sqlite3_bind_xxx"); + sqlite3_finalize (stmt); + return cnt; + } if (sqlite3_step (stmt) != SQLITE_ROW) break; size = sqlite3_column_bytes (stmt, 0);