aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datastore/plugin_datastore_sqlite.c15
1 files 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,
908 GNUNET_SQ_query_param_end 908 GNUNET_SQ_query_param_end
909 }; 909 };
910 910
911 /* SQLite doesn't like it when you try to bind a parameter greater than the
912 * last numbered parameter, but unused parameters in the middle are OK.
913 */
911 if (! use_type) 914 if (! use_type)
912 memset (&params[3], 0, sizeof (struct GNUNET_SQ_QueryParam)); 915 {
913 if (! use_key) 916 params[3] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end;
914 memset (&params[2], 0, sizeof (struct GNUNET_SQ_QueryParam)); 917 if (! use_key)
918 {
919 params[2] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end;
920 if (! use_rvalue)
921 params[1] = (struct GNUNET_SQ_QueryParam) GNUNET_SQ_query_param_end;
922 }
923 }
915 if (random) 924 if (random)
916 { 925 {
917 rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, 926 rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,