From 6e4556849c4b0ce7fb341255f9954f1853493495 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 20 Sep 2018 14:49:00 +0300 Subject: [PATCH] Deal with columns being NULL As it is not possible to create an std::string from NULL, we need to handle each value separately. --- maxscale-system-test/mariadb_func.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/maxscale-system-test/mariadb_func.cpp b/maxscale-system-test/mariadb_func.cpp index b00943e2a..6bfbd3aec 100644 --- a/maxscale-system-test/mariadb_func.cpp +++ b/maxscale-system-test/mariadb_func.cpp @@ -549,7 +549,14 @@ Result get_result(MYSQL* conn, std::string sql) while (row) { - rval.emplace_back(&row[0], &row[mysql_num_fields(res)]); + std::vector tmp; + int n = mysql_num_fields(res); + for (int i = 0; i < n; ++i) + { + tmp.push_back(row[i] ? row[i] : ""); + } + rval.push_back(tmp); + row = mysql_fetch_row(res); } mysql_free_result(res);