robbat2,
Wednesday, July 10, 2002, 7:01:39 AM, you wrote:

r> Description:
r>         I have been writing an SQL tokenizer for the phpMyAdmin project, on which I 
am a core developer.
r> I used this page (Manual 6.1.2 Database, Table, Index, Column, and Alias Names) for 
reference 
r> as to what a valid token was. As well as this reference on SQL User Variables 
(Manual 6.1.4 User Variables).

r> Most specificly, it states that an identifier CAN start with a number.
r> Ergo,
r> 0xff could be an identifer or a hexadecimal number.

r> However,
r> 0xgff and 0xffg
r> are not valid hexadecimal numbers, and are only valid as identifiers.

r> Use my SQL fragment below, and note the results of the two SELECT queries.  

r> While the 0xgff column produces correct results, The 0xfffffge column does not. The 
column title is garbled.

r> How-To-Repeat:
r> CREATE TABLE `strtest` (
r>   `0xfffffge` int(10) unsigned zerofill NOT NULL auto_increment,
r>   `0xgff` varchar(255) NOT NULL default '',
r>   PRIMARY KEY  (`0xfffffge`)
r> ) TYPE=MyISAM;
r> INSERT INTO strtest VALUES (0000000001, 'Foo');

r> SELECT * FROM strtest;
r> SELECT 0xfffffge,0xgff FROM strtest;
        
>>Fix:
r>         Make tokens that fail as being hexadecimal numbers be recognized as 
identifiers only.

You should quote column name as in your CREATE TABLE statement:
mysql> SELECT `0xfffffge`,`0xgff` FROM strtest;
+------------+-------+
| 0xfffffge  | 0xgff |
+------------+-------+
| 0000000001 | Foo   |
+------------+-------+
1 row in set (0.00 sec)





-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to