diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-10-15 18:41:29 +0900 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2018-10-15 18:41:29 +0900 |
commit | 03fb70c9384b208cbeb57fb6c9b06145aa9c2e9e (patch) | |
tree | 4bbf347dd239440874beb2720d17c0312adf2990 /src/namestore/plugin_namestore_sqlite.c | |
parent | 4cefd61da32ee7adf3cfc4167217bfcbb1e6d2e3 (diff) | |
download | gnunet-03fb70c9384b208cbeb57fb6c9b06145aa9c2e9e.tar.gz gnunet-03fb70c9384b208cbeb57fb6c9b06145aa9c2e9e.zip |
modify sqlite logic to accomodate rowcount starting from 1
Diffstat (limited to 'src/namestore/plugin_namestore_sqlite.c')
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 15 |
1 files changed, 8 insertions, 7 deletions
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) | |||
152 | &plugin->zone_to_name), | 152 | &plugin->zone_to_name), |
153 | GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label" | 153 | GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label" |
154 | " FROM ns098records" | 154 | " FROM ns098records" |
155 | " WHERE zone_private_key=? AND _rowid_ >= ?" | 155 | " WHERE zone_private_key=? AND uid >= ?" |
156 | " ORDER BY _rowid_ ASC" | 156 | " ORDER BY uid ASC" |
157 | " LIMIT ?", | 157 | " LIMIT ?", |
158 | &plugin->iterate_zone), | 158 | &plugin->iterate_zone), |
159 | GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label,zone_private_key" | 159 | GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label,zone_private_key" |
160 | " FROM ns098records" | 160 | " FROM ns098records" |
161 | " WHERE _rowid_ >= ?" | 161 | " WHERE uid >= ?" |
162 | " ORDER BY _rowid_ ASC" | 162 | " ORDER BY uid ASC" |
163 | " LIMIT ?", | 163 | " LIMIT ?", |
164 | &plugin->iterate_all_zones), | 164 | &plugin->iterate_all_zones), |
165 | GNUNET_SQ_make_prepare ("SELECT uid,record_count,record_data,label,zone_private_key" | 165 | 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, | |||
540 | zk = *zone_key; | 540 | zk = *zone_key; |
541 | if (NULL != iter) | 541 | if (NULL != iter) |
542 | iter (iter_cls, | 542 | iter (iter_cls, |
543 | seq + 1, | 543 | seq, |
544 | &zk, | 544 | &zk, |
545 | label, | 545 | label, |
546 | record_count, | 546 | record_count, |
@@ -627,11 +627,12 @@ namestore_sqlite_iterate_records (void *cls, | |||
627 | struct Plugin *plugin = cls; | 627 | struct Plugin *plugin = cls; |
628 | sqlite3_stmt *stmt; | 628 | sqlite3_stmt *stmt; |
629 | int err; | 629 | int err; |
630 | uint64_t rowid = serial + 1; //SQLite starts counting at 1 | ||
630 | 631 | ||
631 | if (NULL == zone) | 632 | if (NULL == zone) |
632 | { | 633 | { |
633 | struct GNUNET_SQ_QueryParam params[] = { | 634 | struct GNUNET_SQ_QueryParam params[] = { |
634 | GNUNET_SQ_query_param_uint64 (&serial), | 635 | GNUNET_SQ_query_param_uint64 (&rowid), |
635 | GNUNET_SQ_query_param_uint64 (&limit), | 636 | GNUNET_SQ_query_param_uint64 (&limit), |
636 | GNUNET_SQ_query_param_end | 637 | GNUNET_SQ_query_param_end |
637 | }; | 638 | }; |
@@ -644,7 +645,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
644 | { | 645 | { |
645 | struct GNUNET_SQ_QueryParam params[] = { | 646 | struct GNUNET_SQ_QueryParam params[] = { |
646 | GNUNET_SQ_query_param_auto_from_type (zone), | 647 | GNUNET_SQ_query_param_auto_from_type (zone), |
647 | GNUNET_SQ_query_param_uint64 (&serial), | 648 | GNUNET_SQ_query_param_uint64 (&rowid), |
648 | GNUNET_SQ_query_param_uint64 (&limit), | 649 | GNUNET_SQ_query_param_uint64 (&limit), |
649 | GNUNET_SQ_query_param_end | 650 | GNUNET_SQ_query_param_end |
650 | }; | 651 | }; |