[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13937 - in gnunet/src: datacache datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13937 - in gnunet/src: datacache datastore |
Date: |
Sun, 19 Dec 2010 21:06:27 +0100 |
Author: grothoff
Date: 2010-12-19 21:06:27 +0100 (Sun, 19 Dec 2010)
New Revision: 13937
Modified:
gnunet/src/datacache/plugin_datacache_sqlite.c
gnunet/src/datastore/plugin_datastore_sqlite.c
Log:
fix
Modified: gnunet/src/datacache/plugin_datacache_sqlite.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_sqlite.c 2010-12-19 18:56:26 UTC
(rev 13936)
+++ gnunet/src/datacache/plugin_datacache_sqlite.c 2010-12-19 20:06:27 UTC
(rev 13937)
@@ -423,6 +423,8 @@
{
struct GNUNET_DATACACHE_PluginFunctions *api = cls;
struct Plugin *plugin = api->cls;
+ int result;
+ sqlite3_stmt *stmt;
#if !WINDOWS || defined(__CYGWIN__)
if (0 != UNLINK (plugin->fn))
@@ -431,7 +433,37 @@
plugin->fn);
GNUNET_free (plugin->fn);
#endif
- sqlite3_close (plugin->dbh);
+ result = sqlite3_close (plugin->dbh);
+#if SQLITE_VERSION_NUMBER >= 3007000
+ if (result == SQLITE_BUSY)
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "sqlite",
+ _("Tried to close sqlite without finalizing all prepared
statements.\n"));
+ stmt = sqlite3_next_stmt(plugin->dbh, NULL);
+ while (stmt != NULL)
+ {
+#if DEBUG_SQLITE
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "sqlite", "Closing statement %p\n", stmt);
+#endif
+ result = sqlite3_finalize(stmt);
+#if DEBUG_SQLITE
+ if (result != SQLITE_OK)
+ 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->dbh,
+ GNUNET_ERROR_TYPE_ERROR,
+ "sqlite3_close");
+
#if WINDOWS && !defined(__CYGWIN__)
if (0 != UNLINK (plugin->fn))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2010-12-19 18:56:26 UTC
(rev 13936)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2010-12-19 20:06:27 UTC
(rev 13937)
@@ -359,6 +359,8 @@
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 @@
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 @@
"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);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13937 - in gnunet/src: datacache datastore,
gnunet <=