Bug #1337 Prepared Statement doesn' like LIMIT ? parameter
Submitted: 18 Sep 2003 10:55 Modified: 3 Oct 2003 11:48
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[18 Sep 2003 10:55] [ name withheld ]
Description:
Looks like it isn't completely functional yet 
 Prepared statemens doesn't like the second ? It gives a SQL parse error. Why ? 
 I put the newline in just to make sure the error was the second ? not the 
first. 
 The error message tells you what line of the SQL statment the error is on. 
  
 "SELECT token FROM indexdata WHERE token >= ? \n ORDER BY token LIMIT ? " 

How to repeat:
CREATE TABLE indexdata ( token VARCHAR(255) NOT NULL , data BLOB, PRIMARY KEY ( 
token )); 
"SELECT token FROM indexdata WHERE token >= ? \n ORDER BY token LIMIT ? "
[3 Oct 2003 11:48] Indrek Siitan
This doesn't qualify as a bug. LIMIT requires an integer constant (or two)
as parameters, but prepared statement passes it as a data value, which
means quoted -- LIMIT '1' instead of LIMIT 1 what MySQL expects.
[7 Oct 2003 23:42] [ name withheld ]
Well then how do you specify a variable limit between queries ? 
Create a prepared statement for every integer ?  
Come on what is your solution. 
 
Postgres can do this
[8 Oct 2003 13:48] Brian Aker
See CPAN bug: 
http://rt.cpan.org/NoAuth/Bug.html?id=3016
[31 Aug 2009 9:02] d di
Related: bug 34629