From 18040d4772cb87d249c3b8a627f17c38f3c0be03 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 16 Oct 2018 14:57:57 +0200 Subject: [PATCH] Properly escape column name in "createFunction" call Signed-off-by: Morris Jobke --- lib/Categories/Stats.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Categories/Stats.php b/lib/Categories/Stats.php index 41e49bd2..dd0fc1ba 100644 --- a/lib/Categories/Stats.php +++ b/lib/Categories/Stats.php @@ -125,11 +125,11 @@ protected function countStorages($type) { * @return int */ protected function countEntries($tableName, $column = '*') { + $query = $this->connection->getQueryBuilder(); + if ($column !== '*') { - $column = 'DISTINCT(' . $column . ')'; + $column = 'DISTINCT(' . $query->getColumnName($column ) . ')'; } - - $query = $this->connection->getQueryBuilder(); $query->selectAlias($query->createFunction('COUNT(' . $column . ')'), 'num_entries') ->from($tableName); $result = $query->execute();