From e35964089939fd3449034734234ea39fb445ea57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20M=C3=BCller?= Date: Fri, 16 Feb 2018 09:27:16 +0100 Subject: [PATCH] Don't use double quotes in MySQL queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MySQL databases with the ANSI_QUOTES mode enabled treat " as an identifier quote (see https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_ansi_quotes). So for such databases the 'occ upgrade' fails with an error message like this: ... unknown column 'oc_*' in where clause. This fix replaces the doulbe quotes with single quotes that should be always used in MySQL queries to quote literal strings. Signed-off-by: Robin Müller --- lib/private/Repair/Collation.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index a01700e047..33694826b6 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -5,6 +5,7 @@ * @author Morris Jobke * @author Robin Appelman * @author Thomas Müller + * @author Robin Müller * * @license AGPL-3.0 * @@ -123,7 +124,7 @@ class Collation implements IRepairStep { " FROM INFORMATION_SCHEMA . COLUMNS" . " WHERE TABLE_SCHEMA = ?" . " AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" . - " AND TABLE_NAME LIKE \"*PREFIX*%\"", + " AND TABLE_NAME LIKE '*PREFIX*%'", array($dbName) ); $rows = $statement->fetchAll(); @@ -138,7 +139,7 @@ class Collation implements IRepairStep { " FROM INFORMATION_SCHEMA . TABLES" . " WHERE TABLE_SCHEMA = ?" . " AND TABLE_COLLATION <> '" . $characterSet . "_bin'" . - " AND TABLE_NAME LIKE \"*PREFIX*%\"", + " AND TABLE_NAME LIKE '*PREFIX*%'", [$dbName] ); $rows = $statement->fetchAll();