From 8d5c94ac3e45e910f617d6951a3236b4d92babe3 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 13 Nov 2002 13:25:23 +0000 Subject: [PATCH] unquoted identifiers --- ChangeLog | 3 +++ libraries/sqlparser.lib.php3 | 31 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b8f9f158..3a8680e64 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-11-13 Marc Delisle + * libraries/sqlparser.lib.php3: bug 636575 (unquoted identifiers) + 2002-11-11 Alexander M. Turek * libaries/common.lib.php3: Fixed bug #636345 (Error when modifying table keys). diff --git a/libraries/sqlparser.lib.php3 b/libraries/sqlparser.lib.php3 index ed918f153..9d6830bf4 100644 --- a/libraries/sqlparser.lib.php3 +++ b/libraries/sqlparser.lib.php3 @@ -703,23 +703,24 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) { || ($arr[$i]['type'] == 'quote_single') || ($arr[$i]['type'] == 'alpha_identifier')) { + switch ($arr[$i]['type']) { + case 'alpha_identifier': + $identifier = $arr[$i]['data']; + break; + //TODO: check embedded double quotes or backticks? // and/or remove just the first and last character? - if ($arr[$i]['type'] == 'quote_backtick') { - // remove backticks - $identifier = str_replace('`','',$arr[$i]['data']); - } - - if ($arr[$i]['type'] == 'quote_double') { - // remove double quotes - $identifier = str_replace('"','',$arr[$i]['data']); - } - - if ($arr[$i]['type'] == 'quote_single') { - // remove single quotes - $identifier = str_replace("'","",$arr[$i]['data']); - } - + case 'quote_backtick': + $identifier = str_replace('`','',$arr[$i]['data']); + break; + case 'quote_double': + $identifier = str_replace('"','',$arr[$i]['data']); + break; + case 'quote_single': + $identifier = str_replace("'","",$arr[$i]['data']); + break; + } // end switch + if ($subresult['querytype'] == 'SELECT') { if (!$seen_from) { if ($previous_was_identifier) {