benpjohnson / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

script dies when query is not well-formed #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. execute this code :

$sql = 'SELECT [CONCAT(a, b)] from c';
$parser = new PHPSQLParser($sql, true);

2. script dies with this message :

cannot calculate position of b) within , b)] from c

What is the expected output? What do you see instead?

The documentation says the query should be well-formed, so this is probably 
more of an enhancement request. Would it be possible to throw an Exception 
instead of using 'die' and 'exit' in the library?
Or is there an easy way for the client code to recover from such an error?

What version of the product are you using? On what operating system?

r235 on windows7

Please provide any additional information below.

Original issue reported on code.google.com by nderm...@adequasys.com on 22 Apr 2012 at 6:30

GoogleCodeExporter commented 9 years ago
I have added a stop() method, which is called on critical conditions, you can 
overwrite it in a sub-class. 

Original comment by pho...@gmx.de on 26 Apr 2012 at 12:33

GoogleCodeExporter commented 9 years ago
I have removed the stop method and throw now exceptions.

Original comment by pho...@gmx.de on 26 Apr 2012 at 3:52

GoogleCodeExporter commented 9 years ago

Original comment by pho...@gmx.de on 30 Apr 2012 at 11:25