From b673e9c3ed4a211b974bc602b893a427533566d7 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Mon, 5 Feb 2018 21:52:21 -0600 Subject: [PATCH] fix datstore bind issue for real this time --- src/datastore/plugin_datastore_sqlite.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 380238bb5..4980f8109 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -908,10 +908,19 @@ sqlite_plugin_get_key (void *cls, GNUNET_SQ_query_param_end }; + /* SQLite doesn't like it when you try to bind a parameter greater than the + * last numbered parameter, but unused parameters in the middle are OK. + */ if (! use_type) - memset (¶ms[3], 0, sizeof (struct GNUNET_SQ_QueryParam)); - if (! use_key) - memset (¶ms[2], 0, sizeof (struct GNUNET_SQ_QueryParam)); + { + params[3] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end; + if (! use_key) + { + params[2] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end; + if (! use_rvalue) + params[1] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end; + } + } if (random) { rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, -- 2.25.1