PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » SQL_Parser » Bug #7416

PATCH NEEDED - Pound Sign Breaking Legal Field Names

Details

Request #7416PATCH NEEDED - Pound Sign Breaking Legal Field Names
Submitted2006-04-18 12:22 UTC
Frommaps at servangle dot net
StatusOpen
PackageSQL_Parser
PHP Versionall
OSSolaris & DB2
Roadmaps(Not assigned)

Comments

[2006-04-18 12:22 UTC] maps at servangle dot net

Description:
------------
Pound sign's (#) are breaking the SQL parsing. The pound sign is a legal character representation in DB2 field names. Example:
SELECT * FROM DB2TEST.MYTABLE WHERE TOT#CUST = '1'

Test script:
---------------
Recommended patches:

Lexer.php (line:246)
if (ctype_alpha(ord($c))) { // keyword or ident
--change to--
if (ctype_alpha(ord($c)) || ($c == '#' )) { // keyword or ident

Lexer.php (line:304)
if (ctype_alnum(ord($c)) || ($c == '_') || ($c == '.')) {
--change to--
if (ctype_alnum(ord($c)) || ($c == '_') || ($c == '.') || ($c == '#')) {

Expected result:
----------------
Successfully parsed SQL statement.

Actual result:
--------------
Partially parsed SQL statement. The parser seems to jump out of parsing when a # sign is encountered.