gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5588 - GNUnet/src/applications/dstore


From: gnunet
Subject: [GNUnet-SVN] r5588 - GNUnet/src/applications/dstore
Date: Sun, 2 Sep 2007 18:44:23 -0600 (MDT)

Author: grothoff
Date: 2007-09-02 18:44:23 -0600 (Sun, 02 Sep 2007)
New Revision: 5588

Modified:
   GNUnet/src/applications/dstore/dstore.c
Log:
checks

Modified: GNUnet/src/applications/dstore/dstore.c
===================================================================
--- GNUnet/src/applications/dstore/dstore.c     2007-09-03 00:28:00 UTC (rev 
5587)
+++ GNUnet/src/applications/dstore/dstore.c     2007-09-03 00:44:23 UTC (rev 
5588)
@@ -311,13 +311,36 @@
       MUTEX_UNLOCK (lock);
       return SYSERR;
     }
-  sqlite3_bind_int64 (stmt, 1, get_time ());
-  sqlite3_bind_int64 (stmt, 2, discard_time);
-  sqlite3_bind_blob (stmt, 3, key, sizeof (HashCode512), SQLITE_TRANSIENT);
-  sqlite3_bind_int (stmt, 4, type);
-  sqlite3_bind_int (stmt, 5, size);
-  sqlite3_bind_blob (stmt, 6, data, size, SQLITE_TRANSIENT);
-  sqlite3_step (stmt);
+  if ((SQLITE_OK != sqlite3_bind_int64 (stmt, 1, get_time ())) ||
+      (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, discard_time)) ||
+      (SQLITE_OK !=
+       sqlite3_bind_blob (stmt, 3, key, sizeof (HashCode512),
+                          SQLITE_TRANSIENT))
+      || (SQLITE_OK != sqlite3_bind_int (stmt, 4, type))
+      || (SQLITE_OK != sqlite3_bind_int (stmt, 5, size))
+      || (SQLITE_OK !=
+          sqlite3_bind_blob (stmt, 6, data, size, SQLITE_TRANSIENT)))
+    {
+      GE_LOG (coreAPI->ectx,
+              GE_ERROR | GE_ADMIN | GE_BULK,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "sqlite3_bind_xxx", __FILE__, __LINE__, sqlite3_errmsg (dbh));
+      sqlite3_finalize (stmt);
+      sqlite3_close (dbh);
+      MUTEX_UNLOCK (lock);
+      return SYSERR;
+    }
+  if (SQLITE_DONE != sqlite3_step (stmt))
+    {
+      GE_LOG (coreAPI->ectx,
+              GE_ERROR | GE_ADMIN | GE_BULK,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "sqlite3_step", __FILE__, __LINE__, sqlite3_errmsg (dbh));
+      sqlite3_finalize (stmt);
+      sqlite3_close (dbh);
+      MUTEX_UNLOCK (lock);
+      return SYSERR;
+    }
   ret = sqlite3_changes (dbh);
   sqlite3_finalize (stmt);
   if (ret > 0)
@@ -358,13 +381,13 @@
       && (SQLITE_OK ==
           sqlite3_bind_blob (stmt, 6, data, size, SQLITE_TRANSIENT)))
     {
-      if (SQLITE_DONE != sqlite3_step (stmt)) 
+      if (SQLITE_DONE != sqlite3_step (stmt))
         LOG_SQLITE (dbh,
                     GE_ERROR | GE_DEVELOPER | GE_ADMIN | GE_BULK,
                     "sqlite3_step");
-      else 
+      else
         payload += size + OVERHEAD;
-       if (SQLITE_OK != sqlite3_finalize (stmt))
+      if (SQLITE_OK != sqlite3_finalize (stmt))
         LOG_SQLITE (dbh,
                     GE_ERROR | GE_DEVELOPER | GE_ADMIN | GE_BULK,
                     "sqlite3_finalize");





reply via email to

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