From 22eedabe58a1c3541d08214632eafce214261f16 Mon Sep 17 00:00:00 2001 From: VaclavT Date: Mon, 20 Sep 2021 18:25:43 +0200 Subject: [PATCH] null needs to be mapped too --- ml_usql.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ml_usql.cpp b/ml_usql.cpp index 09e750a..03f43c6 100644 --- a/ml_usql.cpp +++ b/ml_usql.cpp @@ -21,7 +21,9 @@ MlValue uSQL::ivaluize(const usql::Table *table) { for (int i = 0; i < table->columns_count(); i++) { auto & c = row[i]; auto type = table->m_col_defs[i].type; - if (type == ColumnType::integer_type || type == ColumnType::date_type) { + if (c.isNull()) { + columns.push_back(MlValue::nil()); + } else if (type == ColumnType::integer_type || type == ColumnType::date_type) { columns.push_back(MlValue(c.getIntValue())); } else if (type == ColumnType::bool_type) { columns.push_back(c.getBoolValue() ? MlValue(c.getIntValue()) : MlValue::nil());