From c93e3677006cbeb4a38496b20b5a9994ee36e997 Mon Sep 17 00:00:00 2001 From: avsdev-cw Date: Mon, 9 Nov 2020 12:37:49 +0000 Subject: [PATCH] Better handling of NULL db values --- src/db_value.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/db_value.c b/src/db_value.c index feb6c1a..a76bd33 100644 --- a/src/db_value.c +++ b/src/db_value.c @@ -52,10 +52,17 @@ void db_value_sbva(str_builder *sb, e_column_type type, uint32_t n_args, va_list int nchar; if (n_args == 0) { + if (type == TYPE_RAW) { + strbld_str(sb, "NULL", 4); + } return; } if (type == TYPE_RAW) { + if (n_args == 0) { + strbld_str(sb, "NULL", 4); + return; + } tmp_str = va_arg(args, char *); tmp_len = va_arg(args, size_t); strbld_str(sb, tmp_str, tmp_len);