allow use of NULL for stirings
authorChristian Grothoff <christian@grothoff.org>
Mon, 13 Mar 2017 19:08:52 +0000 (20:08 +0100)
committerChristian Grothoff <christian@grothoff.org>
Mon, 13 Mar 2017 19:08:52 +0000 (20:08 +0100)
src/sq/sq_query_helper.c
src/sq/sq_result_helper.c

index a04b4ced45e1d0560bc01616c44f4a5fe53597f3..94a3a3f1c868ae8d169f0f9f1ca4507e7e5ff5c9 100644 (file)
@@ -90,6 +90,14 @@ bind_string (void *cls,
              sqlite3_stmt *stmt,
              unsigned int off)
 {
+  if (NULL == data)
+  {
+    if (SQLITE_OK !=
+        sqlite3_bind_null (stmt,
+                           (int) off))
+      return GNUNET_SYSERR;
+    return GNUNET_OK;
+  }
   if (SQLITE_OK !=
       sqlite3_bind_text (stmt,
                          (int) off,
index fad3f3c8d489c209859592bdadab487f37d96103..9579863b2326bc1c7dc9f603138654830e5ab44e 100644 (file)
@@ -228,6 +228,13 @@ extract_utf8_string (void *cls,
   const char *text;
   char **rdst = dst;
 
+  if (SQLITE_NULL ==
+      sqlite3_column_type (result,
+                           column))
+  {
+    *rdst = NULL;
+    return GNUNET_OK;
+  }
   if (SQLITE_TEXT !=
       sqlite3_column_type (result,
                            column))