Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.7.0

Bug #19210 [needs patch] Does not recognize nested SELECT statements
Submitted: 2012-01-09 23:23 UTC
From: nestor Assigned:
Status: Open Package: SQL_Parser (version 0.6.0)
PHP Version: 5.3.1 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2012-01-09 23:23 UTC] nestor (Matthias Freiburghaus)
Description: ------------ The parser does not recognize syntacticaly correct nested SELECT statements Test script: --------------- $parser = new SQL_Parser(); $str ="SELECT e.fld_id AS fid, e.fld_name, e.fld_vorname, e.fld_gebdat, e.fld_eintritt, e.fld_austritt, vp.fld_name AS vpname, (SELECT fld_id FROM tbl_bf_beitraege as b WHERE b.tbl_kinder_fld_id=e.fld_id) AS fld_editable , vp.fld_id AS fld_syncable FROM tbl_kinder AS e LEFT JOIN tbl_v_kinder_vertragspartner AS v ON v.tbl_kinder_fld_id = e.fld_id LEFT JOIN tbl_vertragspartner AS vp ON vp.fld_id = v.tbl_vertragspartner_fld_id WHERE (e.tbl_tagesheim_fld_id='1') ORDER BY e.fld_vorname DESC, e.fld_name ASC LIMIT '100' OFFSET '100'"; $struct = $parser->parse($str); Expected result: ---------------- parsing the string $str Actual result: -------------- Caught exception: Parse error: Expected ")" on line 2 (SELECT fld_id FROM tbl_bf_beitraege as b WHERE b.tbl_kinder_fld_id=e.fld_id) AS fld_editable , ^ found: "fld_id" in: C:\xampp\php\PEAR\SQL\Parser.php#318 from: #0 C:\xampp\php\PEAR\SQL\Parser.php(662): SQL_Parser->raiseError('Expected ")"') #1 C:\xampp\php\PEAR\SQL\Parser.php(1486): SQL_Parser->parseCondition() #2 C:\xampp\php\PEAR\SQL\Parser.php(1714): SQL_Parser->parseSelect() #3 C:\xampp\php\PEAR\SQL\Parser.php(1792): SQL_Parser->parseQuery() #4 C:\xampp\htdocs\parsit.php(29): SQL_Parser->parse('SELECT e.fld_id...') #5 {main}

Comments

 [2012-01-10 07:06 UTC] alan_k (Alan Knowles)
-Summary: Does not recognize nested SELECT statements +Summary: [needs patch] Does not recognize nested SELECT statements
Sounds plausable, you probably need to dig into the code to find out why.