gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r283 - GNUnet/src/applications/sqstore_sqlite


From: durner
Subject: [GNUnet-SVN] r283 - GNUnet/src/applications/sqstore_sqlite
Date: Fri, 18 Feb 2005 09:28:46 -0800 (PST)

Author: durner
Date: 2005-02-18 09:28:45 -0800 (Fri, 18 Feb 2005)
New Revision: 283

Modified:
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
Log:
Fixes.

Comment: Since SQLite is typeless and everything is stored as a zero terminated 
string, we can't get rid of the binary encoding.

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2005-02-17 06:14:27 UTC 
(rev 282)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2005-02-18 17:28:45 UTC 
(rev 283)
@@ -24,8 +24,6 @@
  * @author Nils Durner
  * @todo Estimation of DB size
  * @todo Apply fixes from MySQL module
- * @todo can't we avoid the escaping/unescaping of the data/hash? (MySQL 
prepared
- *       statements certainly don't need it)
  * @todo testcase currently fails 
  *        ("ERROR: 'precompiling' failed at sqlite.c:379 
  *         with error: near "from": syntax error")
@@ -368,7 +366,7 @@
   if (sqlite3_prepare(dbh->dbf, "SELECT count(*) FROM gn070 where hash=?", 39,
          &dbh->countContent, (const char **) &dummy) != SQLITE_OK ||
      
-      sqlite3_prepare(dbh->dbf, "SELECT length(hash), length(value), "
+      sqlite3_prepare(dbh->dbf, "SELECT length(hash), length(value) "
          "from gn070 WHERE hash=?", 59,
          &dbh->exists, (const char **) &dummy) != SQLITE_OK ||
 
@@ -382,6 +380,7 @@
               (const char **) &dummy) != SQLITE_OK) {
         
       LOG_SQLITE(LOG_ERROR, "precompiling");
+      
       FREE(dbh->fn);
       FREE(dbh);
       return NULL;
@@ -651,13 +650,15 @@
     }
 
     FREENONNULL(escapedHash);
-    sqlite3_finalize(stmt);
 
          if (ret != SQLITE_OK) {
            LOG_SQLITE(LOG_ERROR, "sqlite_query");
+      sqlite3_finalize(stmt);
            MUTEX_UNLOCK(&dbh->DATABASE_Lock_);
            return SYSERR;
          }
+
+    sqlite3_finalize(stmt);
   }
   else
        LOG_SQLITE(LOG_ERROR, "sqlite_query");





reply via email to

[Prev in Thread] Current Thread [Next in Thread]