#35801 [Opn->Bgs]: Prepared statement with "LIMIT :limit"

From: Date: Sun, 25 Dec 2005 19:34:14 +0000
Subject: #35801 [Opn->Bgs]: Prepared statement with "LIMIT :limit"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91050@lists.php.net to get a copy of this message
 ID:               35801
 Updated by:       iliaa@php.net
 Reported By:      brice dot joly at free dot fr
-Status:           Open
+Status:           Bogus
 Bug Type:         PDO related
 Operating System: Windows XP
 PHP Version:      5.1.1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Limit statements cannot be part of prepared statements.


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

[2005-12-25 18:38:28] brice dot joly at free dot fr

Tried with snapshot: no more Apache crash.

Yet LIMIT placeholder is still not supported, could someone possibly
forward the feature request to Wez/anyone working on PDO? I think that
would be a welcome addition. Thanks.

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

[2005-12-25 17:34:15] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip



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

[2005-12-25 13:21:11] brice dot joly at free dot fr

Description:
------------
As of MySQL 5.0.7, placeholders can be used in the LIMIT clause when
using prepared statements
(http://dev.mysql.com/doc/refman/5.0/en/select.html). Will this feature
make it to PDO? 

Friendly input: array(':limit' => 10) as well as "pager" input
array(':limit' => array(10, 10)) would make sense for the MySQL driver
since it understands both syntaxes.

Reproduce code:
---------------
Prepared SQL query:

SELECT * FROM table LIMIT :limit

with bindParam(':limit', 10), prepared statement sent to DB will be:

SELECT * FROM table LIMIT "10"

Expected result:
----------------
Double quotes on LIMIT value will raise a MySQL Error 1064: You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '"10"' at line 1.
Of course MySQL expects 

SELECT * FROM table LIMIT 10

Actual result:
--------------
Apache crashes, log reads:

Parent: child process exited with status 3221225477 -- Restarting.

No Exception/PHP Error, tested on WinXP, Apache/2.0.52, PHP 5.1.1,
MySQL 5.0.17


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


-- 
Edit this bug report at http://bugs.php.net/?id=35801&edit=1


Thread (4 messages)

« previous php.bugs (#91050) next »