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());