diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-12-19 20:06:27 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2010-12-19 20:06:27 +0000 |
commit | de538db5bb3cf814e4fdc8ae5e62b3c00f63a54d (patch) | |
tree | 9252e6fe76cb8012c4bdbcbfa960e6d75fa44b52 /src/datastore/plugin_datastore_sqlite.c | |
parent | ad4a6939f4ea5049b3180c5ab0e57226b8a3f6a8 (diff) |
fix
git-svn-id: https://gnunet.org/svn/gnunet@13937 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 1b83825377..1f7348a984 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -359,6 +359,8 @@ static void database_shutdown (struct Plugin *plugin) { int result; + sqlite3_stmt *stmt; + if (plugin->delRow != NULL) sqlite3_finalize (plugin->delRow); if (plugin->updPrio != NULL) @@ -366,13 +368,14 @@ database_shutdown (struct Plugin *plugin) 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, @@ -385,9 +388,16 @@ database_shutdown (struct Plugin *plugin) "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); } |