database_shutdown (struct Plugin *plugin)
{
int result;
+ sqlite3_stmt *stmt;
+ stmt = NULL;
+
if (plugin->delRow != NULL)
sqlite3_finalize (plugin->delRow);
if (plugin->updPrio != NULL)
if (plugin->insertContent != NULL)
sqlite3_finalize (plugin->insertContent);
result = sqlite3_close(plugin->dbh);
- while (result == SQLITE_BUSY)
+#if SQLITE_VERSION_NUMBER >= 3007000
+ if (result == SQLITE_BUSY)
{
- sqlite3_stmt *stmt;
GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
"sqlite",
_("Tried to close sqlite without finalizing all prepared statements.\n"));
- for (stmt = sqlite3_next_stmt(plugin->dbh, NULL); stmt != NULL; stmt = sqlite3_next_stmt(plugin->dbh, NULL))
+ stmt = sqlite3_next_stmt(plugin->dbh, NULL);
+ while (stmt != NULL)
{
#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
"sqlite",
"Failed to close statement %p: %d\n", stmt, result);
#endif
+ stmt = sqlite3_next_stmt(plugin->dbh, NULL);
}
result = sqlite3_close(plugin->dbh);
}
+#endif
+ if (SQLITE_OK != result)
+ LOG_SQLITE (plugin, NULL,
+ GNUNET_ERROR_TYPE_ERROR,
+ "sqlite3_close");
+
GNUNET_free_non_null (plugin->fn);
}