LIMIT clause and placeholders

LIMIT clause and placeholders

am 05.03.2004 09:59:24 von beau

Hello -

I noticed the following problem occurs when placeholders
are used in statements with a LIMIT clause.

Using the command line 'mysql' utility:

mysql> select * from some_table limit 10;
OK
mysql> select * from some_table limit '10';
Syntax error [blah, blah, ...] near ''10''...

Using DBI/DBD::mysql (9.2003 and cvs tested):

my $sth = $dbh->prepare("select * from some_table limit ?");
OK
$sth->execute(10);
same syntax error as with 'mysql'

It seems that DBD 'under the covers', quotes all placeholders
whilst contructing the statement to execute, i.e.:

select * from some_table limit '10';

and hence, the syntax error.

The DBI/DBD engine cannot simply not quote placeholders (I know,
I tried it), and not even not quote numeric values (again, I
tested that). It seems something in the mysql engine must indicate
whether or not quotes are allowed, but here is where I stop quessing.

Has anyone else had this problem? Any solutions out there?

Aloha => Beau;

PS: I finally used 'whilst' ;) - not bad for an Hawaiian...


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org