Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Properly escape column name in "createFunction" call
Signed-off-by: Morris Jobke <[email protected]>
  • Loading branch information
MorrisJobke committed Oct 19, 2018
commit 18040d4772cb87d249c3b8a627f17c38f3c0be03
6 changes: 3 additions & 3 deletions lib/Categories/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down