From: iab398 at bham dot ac dot uk
Operating system: Unix
PHP version: 5.2.0
PHP Bug Type: SQLite related
Bug description: Unable to use place holders as part of the actual SQL query
with PDO's
Description:
------------
Example within a PHP context:
/* using sqlite 3 database SQLLDB is a define() path to the database
location elsewhere */
if (!($db = new PDO('sqlite:' . SQLLDB))) {
$error = $db->errorInfo();
die($error[2]);
}
/* the direction in which to order the query */
$direction = "ASC";
$query = $db->prepare('SELECT * FROM table_name ORDER BY value :dir');
$query->bindParam(':dir', $direction, PDO::PARAM_STR, 4);
$query->execute();
Here, a error stating that the prepare() failed occurs due to acting on a
non-object. Would it be possible to maybe allow place holders for actual
parts of the SQL query, rather than just values?
Cheers
Reproduce code:
---------------
as above.
Expected result:
----------------
for the data to be retrieved from the database and ordered either ASC or
DESC according to the value of $direction
Actual result:
--------------
PDO/SQLite error. As above.
--
Edit bug report at http://bugs.php.net/?id=39906&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39906&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39906&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39906&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39906&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39906&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39906&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39906&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39906&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39906&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39906&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39906&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39906&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39906&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39906&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39906&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39906&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39906&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39906&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39906&r=mysqlcfg