FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19210&edit=1

ID: 19210
Updated by: alan@akbkhome.com
Reported By: matthias dot freiburghaus at centerboard dot ch
-Summary: Does not recognize nested SELECT statements
+Summary: [needs patch] Does not recognize nested SELECT
statements
Status: Open
Type: Bug
Package: SQL_Parser
Package Version: 0.6.0
PHP Version: 5.3.1
Roadmap Versions:
New Comment:

-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.


Previous Comments:
------------------------------------------------------------------------

[2012-01-09 18:23:17] nestor

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}

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 10, '12 at 1:05a
activeJan 10, '12 at 1:05a
posts1
users1
websitepear.php.net

1 user in discussion

Alan: 1 post

People

Translate

site design / logo © 2021 Grokbase