From 2385bf72bd1287b4564eaba5efa5dd276fdb21c4 Mon Sep 17 00:00:00 2001 From: Vladimir Goncharov Date: Wed, 17 Nov 2021 14:48:29 +0200 Subject: [PATCH] support for array values in clickhouse driver --- plugins/drivers/clickhouse.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/drivers/clickhouse.php b/plugins/drivers/clickhouse.php index 48a2e68d..5b2d615c 100644 --- a/plugins/drivers/clickhouse.php +++ b/plugins/drivers/clickhouse.php @@ -90,8 +90,14 @@ if (isset($_GET["clickhouse"])) { var $num_rows, $_rows, $columns, $meta, $_offset = 0; function __construct($result) { + foreach ($result['data'] as $item) { + $row = array(); + foreach ($item as $key => $val) { + $row[$key] = is_scalar($val) ? $val : json_encode($val, 256); // 256 - JSON_UNESCAPED_UNICODE + } + $this->_rows[] = $row; + } $this->num_rows = $result['rows']; - $this->_rows = $result['data']; $this->meta = $result['meta']; $this->columns = array_column($this->meta, 'name'); reset($this->_rows);