Re: Token parsing incorrect behavior
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 0xfge column does not. The column title is garbled. r How-To-Repeat: r CREATE TABLE `strtest` ( r `0xfge` int(10) unsigned zerofill NOT NULL auto_increment, r `0xgff` varchar(255) NOT NULL default '', r PRIMARY KEY (`0xfge`) r ) TYPE=MyISAM; r INSERT INTO strtest VALUES (01, 'Foo'); r SELECT * FROM strtest; r SELECT 0xfge,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 `0xfge`,`0xgff` FROM strtest; ++---+ | 0xfge | 0xgff | ++---+ | 01 | 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
Token parsing incorrect behavior
Description: I have been writing an SQL tokenizer for the phpMyAdmin project, on which I am a core developer. I used this page (Manual 6.1.2 Database, Table, Index, Column, and Alias Names) for reference as to what a valid token was. As well as this reference on SQL User Variables (Manual 6.1.4 User Variables). Most specificly, it states that an identifier CAN start with a number. Ergo, 0xff could be an identifer or a hexadecimal number. However, 0xgff and 0xffg are not valid hexadecimal numbers, and are only valid as identifiers. Use my SQL fragment below, and note the results of the two SELECT queries. While the 0xgff column produces correct results, The 0xfge column does not. The column title is garbled. How-To-Repeat: CREATE TABLE `strtest` ( `0xfge` int(10) unsigned zerofill NOT NULL auto_increment, `0xgff` varchar(255) NOT NULL default '', PRIMARY KEY (`0xfge`) ) TYPE=MyISAM; INSERT INTO strtest VALUES (01, 'Foo'); SELECT * FROM strtest; SELECT 0xfge,0xgff FROM strtest; Fix: Make tokens that fail as being hexadecimal numbers be recognized as identifiers only. Submitter-Id: submitter ID Originator:Robin Johnson Organization: Orbis-Terrarum Networks MySQL support: none Synopsis: Token parsing incorrect behavior with hexadecimal like identifiers Severity: serious Priority: medium Category: mysql Class: sw-bug Release: mysql-3.23.51-robbat2 (yes) The -robbat2 extra tag on the version is just an identifer I use to identify all of my MySQL servers. Environment: System: Linux matchbox 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown Architecture: i686 Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/local/bin/gcc /usr/bin/cc GCC: Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs Configured with: ../gcc-3.1/configure --enable-languages=c,c++,f77,objc,java Thread model: single gcc version 3.1 Compilation info: CC='gcc' CFLAGS='-O3 -DUSE_SYMDIR' CXX='gcc' CXXFLAGS='-O3 -felide-constructors -fno-exceptions -fno-rtti' LDFLAGS='' LIBC: lrwxrwxrwx1 root root 13 Jun 24 16:51 /lib/libc.so.6 - libc-2.2.5.so -rwxr-xr-x1 root root 1260480 Apr 15 06:44 /lib/libc-2.2.5.so -rw-r--r--1 root root 2310808 Apr 15 07:02 /usr/lib/libc.a -rw-r--r--1 root root 178 Apr 15 06:55 /usr/lib/libc.so Configure command: ./configure --prefix=/usr/local/mysql --with-innodb --with-comment --with-extra-charsets=all --with-server-suffix=-robbat2 --enable-local-infile --enable-assembler --with-mysqld-ldflags=-all-static --with-bdb 'CFLAGS=-O3 -DUSE_SYMDIR' 'CXXFLAGS=-O3 -felide-constructors -fno-exceptions -fno-rtti' CXX=gcc - 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