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

 ID:                 52746
 Updated by:         paj...@php.net
 Reported by:        damien at tournoud dot net
 Summary:            SQLite error "bind or column index out of range"
                     with some placeholders
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            SQLite related
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

hi Damien,



Do you use the bundled sqlite or a system version? If the latter, which
version is it?


Previous Comments:
------------------------------------------------------------------------
[2010-08-30 20:20:28] damien at tournoud dot net

Description:
------------
The following snippet results in a PDOException with message
"SQLSTATE[HY000]: General error: 25 bind or column index out of range".



For some reasons, relatively similar queries work (for example, without
the aggregation, as in: "SELECT * FROM (SELECT :value value FROM
sqlite_master) my_table" or without the table as in "SELECT COUNT(*)
expression FROM (SELECT :value value) my_table").





Test script:
---------------
<?php

$db = new PDO('sqlite:/tmp/sqlite.db');

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);



$query = $db->prepare('SELECT COUNT(*) expression FROM (SELECT :value
value FROM sqlite_master) my_table');

$query->execute(array(':value' => 'my_value'));

?>



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



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

Reply via email to