napoler / 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

=? unsupported #68

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following query returns the following exception:

SELECT a.`admin_id` FROM admins a WHERE a.admin_username=? AND 
a.admin_password=?

PHP Fatal error:  Uncaught exception 'UnableToCalculatePositionException' with 
message 'cannot calculate position of = within  =? AND a.admin_password =?' in 
/var/www/apidev/trunk/sql/phpsqlparser.php:2023
Stack trace:
#0 /var/www/apidev/trunk/sql/phpsqlparser.php(2039): 
PositionCalculator->lookForBaseExpression('SELECT a.`admin...', 56, Array, 1, 
Array)
#1 /var/www/apidev/trunk/sql/phpsqlparser.php(2039): 
PositionCalculator->lookForBaseExpression('SELECT a.`admin...', 56, Array, 
'WHERE', Array)
#2 /var/www/apidev/trunk/sql/phpsqlparser.php(1910): 
PositionCalculator->lookForBaseExpression('SELECT a.`admin...', 56, Array, 0, 
Array)
#3 /var/www/apidev/trunk/sql/phpsqlparser.php(496): 
PositionCalculator->setPositionsWithinSQL('SELECT a.`admin...', Array)
#4 /var/www/apidev/trunk/sql/phpsqlparser.php(475): PHPSQLParser->parse('SELECT 
a.`admin...', true)
#5 /var/www/apidev/trunk/test.php(6): PHPSQLParser->__construct('SELECT 
a.`admin...', true)

The query works if it is changed to:

SELECT a.`admin_id` FROM admins a WHERE a.admin_username= ? AND 
a.admin_password= ?

This is on 20120703

Original issue reported on code.google.com by fxmul...@gmail.com on 31 Jul 2012 at 3:41

GoogleCodeExporter commented 9 years ago
Did you ask Scully for a rational solution?

Original comment by pho...@gmx.de on 8 Aug 2012 at 7:15

GoogleCodeExporter commented 9 years ago
This problem occurs, because the position calculator awaits some valid 
characters after an operator. I have added the question mark as such a 
character on REV 297.

Original comment by pho...@gmx.de on 8 Aug 2012 at 8:25

GoogleCodeExporter commented 9 years ago

Original comment by pho...@gmx.de on 17 Aug 2012 at 9:26