gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r4780 - GNUnet/src/applications/sqstore_sqlite
Date: Sun, 29 Apr 2007 12:42:50 -0600 (MDT)

Author: grothoff
Date: 2007-04-29 12:42:50 -0600 (Sun, 29 Apr 2007)
New Revision: 4780

Modified:
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
Log:
increment counter also on delete

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2007-04-29 18:18:02 UTC 
(rev 4779)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2007-04-29 18:42:50 UTC 
(rev 4780)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other 
contributing authors)
+     (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Christian Grothoff (and 
other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -438,21 +438,18 @@
     if (i == SQLITE_DONE) {
       ret = 0;
       i = SQLITE_OK;
-    }
-    else if (i == SQLITE_ROW) {
+    } else if (i == SQLITE_ROW) {
       ret = sqlite3_column_double(stmt, 0);
       i = SQLITE_OK;
     }
   }
   sqlite3_finalize(stmt);
-
   if (i != SQLITE_OK) {
     LOG_SQLITE(handle,
               GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
               "sqlite_getStat");
     return SYSERR;
   }
-
   return ret;
 }
 
@@ -482,30 +479,29 @@
 
   if (sq_prepare(dbh,
                 "INSERT INTO gn070(hash, anonLevel, type) VALUES (?, ?, ?)",
-                &stmt) == SQLITE_OK) {
-    sqlite3_bind_text(stmt,
-                     1,
-                     key,
-                     strlen(key),
-                     SQLITE_STATIC);
-    sqlite3_bind_double(stmt,
-                       2,
-                       val);
-    sqlite3_bind_int(stmt,
-                    3,
-                    RESERVED_BLOCK);
-    if (sqlite3_step(stmt) != SQLITE_DONE) {
-      LOG_SQLITE(handle,
-                GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
-                "sqlite_setStat");
-      sqlite3_finalize(stmt);
-      return SYSERR;
-    }
+                &stmt) != SQLITE_OK) 
+    return SYSERR;
+  sqlite3_bind_text(stmt,
+                   1,
+                   key,
+                   strlen(key),
+                   SQLITE_STATIC);
+  sqlite3_bind_double(stmt,
+                     2,
+                     val);
+  sqlite3_bind_int(stmt,
+                  3,
+                  RESERVED_BLOCK);
+  if (sqlite3_step(stmt) != SQLITE_DONE) {
+    LOG_SQLITE(handle,
+              GE_ERROR | GE_ADMIN | GE_USER | GE_BULK,
+              "sqlite_setStat");
     sqlite3_finalize(stmt);
-
-    return OK;
-  } else
     return SYSERR;
+  }
+  sqlite3_finalize(stmt);
+  
+  return OK;
 }
 
 /**
@@ -1196,7 +1192,7 @@
     MUTEX_UNLOCK(db->DATABASE_Lock_);
     return SYSERR;
   }
-
+  db->lastSync++;
   MUTEX_UNLOCK(db->DATABASE_Lock_);
 
 #if DEBUG_SQLITE





reply via email to

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