On Mon, Jan 13, 2003 at 09:16:29AM -0500, Marc Delisle wrote:
There was a function that I removed: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmyadmin/phpMyAdmin/sql.php...
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmyadmin/phpMyAdmin/sql.php... Shows the function quite nicely.
This line is not useless since it puts back a reformatted query, with reserved words upcased.
The things that function is listed as doing are: 1. Separates a backquoted expression with spaces 2. Separates a parenthesized expression with spaces 3. Removes repeated spaces 4. Uppercase reserved words
why do we need to uppercase the words anyway (see further below)? MySQL has never been case-sensitive for reserved AFAIK, that is part of the ANSI SQL standard (which mysql strives to follow).
The SQL parser definetly does #1, #3, #4 and is a lot pickier about using #2.
that was modifying sql_query (see the comments in the function), because later in sql.php3 (current lines 244+) there are several tests made. But this function had problems in some cases. Maybe those tests could be made with the analyzer (some more queryflags) so we would not need to modify $sql_query.
Looking at that code, it looks like a major code-cleaning is needed there, because I see MySQL4 and even later parts of MySQL3.23 subetly failing parts of that code. It uses case-insensative regex for searching negating #4 above. Furthermore that stuff can use the results of the SQL parser for a nice speed improvement (through replacing the slow eregi), and have the same results.
I'll go and rewrite that code to use the SQP results instead. It seems to be lines 48, 92, 222, 239-296, 379. Any more than you can point out ?