gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: modify sqlite logic to acco


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: modify sqlite logic to accomodate rowcount starting from 1
Date: Mon, 15 Oct 2018 11:41:36 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 03fb70c93 modify sqlite logic to accomodate rowcount starting from 1
03fb70c93 is described below

commit 03fb70c9384b208cbeb57fb6c9b06145aa9c2e9e
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Oct 15 18:41:29 2018 +0900

    modify sqlite logic to accomodate rowcount starting from 1
---
 src/namestore/gnunet-service-namestore.c | 20 ++++++++++----------
 src/namestore/plugin_namestore_sqlite.c  | 15 ++++++++-------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/namestore/gnunet-service-namestore.c 
b/src/namestore/gnunet-service-namestore.c
index cdefd0be9..6ad7354ad 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -713,9 +713,8 @@ send_store_response (struct NamestoreClient *nc,
 {
   struct GNUNET_MQ_Envelope *env;
   struct RecordStoreResponseMessage *rcr_msg;
-  
-  if (NULL == nc)
-    return;
+
+  GNUNET_assert (NULL != nc);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Sending RECORD_STORE_RESPONSE message\n");
   GNUNET_STATISTICS_update (statistics,
@@ -804,9 +803,10 @@ refresh_block (struct NamestoreClient *nc,
   }
   if (0 == res_count)
   {
-    send_store_response (nc,
-                         GNUNET_OK,
-                         rid);
+    if (NULL != nc)
+      send_store_response (nc,
+                           GNUNET_OK,
+                           rid);
     return; /* no data, no need to update cache */
   }
   if (GNUNET_YES == disable_namecache)
@@ -815,9 +815,10 @@ refresh_block (struct NamestoreClient *nc,
                              "Namecache updates skipped (NC disabled)",
                              1,
                              GNUNET_NO);
-    send_store_response (nc,
-                         GNUNET_OK,
-                         rid);
+    if (NULL != nc)
+      send_store_response (nc,
+                           GNUNET_OK,
+                           rid);
     return;
   }
   exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count,
@@ -1808,7 +1809,6 @@ handle_iteration_start (void *cls,
   zi->request_id = ntohl (zis_msg->gns_header.r_id);
   zi->offset = 0;
   zi->nc = nc;
-  zi->seq = 1;
   zi->zone = zis_msg->zone;
 
   GNUNET_CONTAINER_DLL_insert (nc->op_head,
diff --git a/src/namestore/plugin_namestore_sqlite.c 
b/src/namestore/plugin_namestore_sqlite.c
index 07784a779..1a4e0138c 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -152,14 +152,14 @@ database_setup (struct Plugin *plugin)
                             &plugin->zone_to_name),
     GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label"
                             " FROM ns098records"
-                            " WHERE zone_private_key=? AND _rowid_ >= ?"
-                            " ORDER BY _rowid_ ASC"
+                            " WHERE zone_private_key=? AND uid >= ?"
+                            " ORDER BY uid ASC"
                             " LIMIT ?",
                             &plugin->iterate_zone),
     GNUNET_SQ_make_prepare ("SELECT 
uid,record_count,record_data,label,zone_private_key"
                             " FROM ns098records"
-                            " WHERE _rowid_ >= ?"
-                            " ORDER BY _rowid_ ASC"
+                            " WHERE uid >= ?"
+                            " ORDER BY uid ASC"
                             " LIMIT ?",
                             &plugin->iterate_all_zones),
     GNUNET_SQ_make_prepare ("SELECT 
uid,record_count,record_data,label,zone_private_key"
@@ -540,7 +540,7 @@ get_records_and_call_iterator (struct Plugin *plugin,
             zk = *zone_key;
           if (NULL != iter)
             iter (iter_cls,
-                             seq + 1,
+                             seq,
                   &zk,
                   label,
                   record_count,
@@ -627,11 +627,12 @@ namestore_sqlite_iterate_records (void *cls,
   struct Plugin *plugin = cls;
   sqlite3_stmt *stmt;
   int err;
+  uint64_t rowid = serial + 1; //SQLite starts counting at 1
 
   if (NULL == zone)
   {
     struct GNUNET_SQ_QueryParam params[] = {
-      GNUNET_SQ_query_param_uint64 (&serial),
+      GNUNET_SQ_query_param_uint64 (&rowid),
       GNUNET_SQ_query_param_uint64 (&limit),
       GNUNET_SQ_query_param_end
     };
@@ -644,7 +645,7 @@ namestore_sqlite_iterate_records (void *cls,
   {
     struct GNUNET_SQ_QueryParam params[] = {
       GNUNET_SQ_query_param_auto_from_type (zone),
-      GNUNET_SQ_query_param_uint64 (&serial),
+      GNUNET_SQ_query_param_uint64 (&rowid),
       GNUNET_SQ_query_param_uint64 (&limit),
       GNUNET_SQ_query_param_end
     };

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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