From 4e3723fd68aeecb838e9e92692fc143196d78273 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 30 Mar 2015 08:29:40 +0000 Subject: [PATCH] quote order column in backup and always quote "index" as it seems to be one of very little names not automatic recogniced in MySQL --- phpgwapi/inc/class.db_backup.inc.php | 2 +- phpgwapi/inc/class.egw_db.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.db_backup.inc.php b/phpgwapi/inc/class.db_backup.inc.php index 8642bc8afe..6e91b31759 100644 --- a/phpgwapi/inc/class.db_backup.inc.php +++ b/phpgwapi/inc/class.db_backup.inc.php @@ -944,7 +944,7 @@ class db_backup empty($pk) || !$max ? false : $pk.' > '.$this->db->quote($max, $schema['fd'][$pk]['type']), __LINE__, __FILE__, empty($pk) ? false : 0, // if no primary key, query all rows - empty($pk) ? '' : 'ORDER BY '.$pk.' ASC', // order by primary key + empty($pk) ? '' : 'ORDER BY '.$this->db->name_quote($pk).' ASC', // order by primary key false, self::ROW_CHUNK) as $row) { if (!empty($pk)) $max = $row[$pk]; diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index eeb67a1c9c..12dbab89f3 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -1366,7 +1366,7 @@ class egw_db { // if name contains special characters, quote it // always quote for postgreSQL, as this is the only way to support mixed case names - if (preg_match('/\W/', $name) || $type == 'pgsql' && preg_match('/[A-Z]+/', $name)) + if (preg_match('/\W/', $name) || $type == 'pgsql' && preg_match('/[A-Z]+/', $name) || $name == 'index') { return $quote . $name . $quote; }