gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r5220 - GNUnet/src/applications/sqstore_mysql


From: gnunet
Subject: [GNUnet-SVN] r5220 - GNUnet/src/applications/sqstore_mysql
Date: Mon, 2 Jul 2007 01:06:03 -0600 (MDT)

Author: grothoff
Date: 2007-07-02 01:06:02 -0600 (Mon, 02 Jul 2007)
New Revision: 5220

Modified:
   GNUnet/src/applications/sqstore_mysql/mysql.c
Log:
fix

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-02 06:54:07 UTC 
(rev 5219)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-02 07:06:02 UTC 
(rev 5220)
@@ -827,7 +827,8 @@
     MUTEX_UNLOCK(lock);
     return SYSERR;
   }
-  if (7 != mysql_num_fields(sql_res)) {
+  if ( (iter != NULL) &&
+       (7 != mysql_num_fields(sql_res)) ) {
     GE_BREAK(ectx, 0);
     iclose(dbh);
     mysql_thread_end();       
@@ -859,7 +860,12 @@
     MUTEX_UNLOCK(lock);
     return SYSERR;
   }
-
+  if (iter == NULL) {
+    count = mysql_stmt_affected_rows(stmt);
+    mysql_thread_end();    
+    MUTEX_UNLOCK(lock);
+    return count;
+  }
   datum = MALLOC(sizeof(Datastore_Value) + MAX_DATUM_SIZE);
   twenty = sizeof(HashCode512);
   dbh->bind[0].buffer = (char*) &size;
@@ -929,25 +935,23 @@
       return count;
     }
     count++;
-    if (iter != NULL) {
-      datum->size = htonl(size);
-      datum->type = htonl(rtype);
-      datum->prio = htonl(prio);
-      datum->anonymityLevel = htonl(level);
-      datum->expirationTime = htonll(expiration);
+    datum->size = htonl(size);
+    datum->type = htonl(rtype);
+    datum->prio = htonl(prio);
+    datum->anonymityLevel = htonl(level);
+    datum->expirationTime = htonll(expiration);
 #if DEBUG_MYSQL
-      GE_LOG(ectx,
-            GE_DEBUG | GE_REQUEST | GE_USER,
-            "Found in database block with type %u.\n",
-            ntohl(*(int*)&datum[1]));
+    GE_LOG(ectx,
+          GE_DEBUG | GE_REQUEST | GE_USER,
+          "Found in database block with type %u.\n",
+          ntohl(*(int*)&datum[1]));
 #endif
-      if( SYSERR == iter(&key,
-                        datum,
-                        closure) ) {
-        count = SYSERR;
-       break;
-      }
-    }
+    if (SYSERR == iter(&key,
+                      datum,
+                      closure) ) {
+      count = SYSERR;
+      break;
+    }    
     datasize = MAX_DATUM_SIZE;
   }
   if (mysql_stmt_errno(stmt)) {





reply via email to

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