From fedc6f0fab4f9a0c1910317a79c96807b947c511 Mon Sep 17 00:00:00 2001 From: Joey Novak Date: Wed, 1 Oct 2014 16:19:00 -0700 Subject: [PATCH] `db`.`column` References in the Order part of a query parse correctly. This query: SELECT `NovaLog`.`id`, `NovaLog`.`type`, `NovaLog`.`message`, `NovaLog`.`email_sent`, `NovaLog`.`hide`, `NovaLog`.`created`, `NovaLog`.`modified` FROM `meridian-dc`.`nova_logs` AS `NovaLog` WHERE `email_sent` = '1' ORDER BY `NovaLog`.`created` DESC LIMIT 1 Would not parse correctly. I did a quick fix that gets it parsing, but I didn't run the test suite yet. --- src/PHPSQL/Parser/Utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PHPSQL/Parser/Utils.php b/src/PHPSQL/Parser/Utils.php index c5b99e5..afdc7b8 100644 --- a/src/PHPSQL/Parser/Utils.php +++ b/src/PHPSQL/Parser/Utils.php @@ -64,6 +64,7 @@ protected function revokeEscaping($sql) { if (($result[0] === '`') && ($result[strlen($result) - 1] === '`')) { $result = substr($result, 1, -1); } + $result = str_replace('`.`', '.', $result); return str_replace('``', '`', $result); }