ID: 42598
User updated by: tobias382 at gmail dot com
Reported By: tobias382 at gmail dot com
Status: Open
Bug Type: PDO related
Operating System: Windows XP SP2
PHP Version: 5.2.4
New Comment:
Replicating this test within a SQLite environment yields the expected
results, so it's possible that the problem is with the PDO_OCI driver.
Previous Comments:
------------------------------------------------------------------------
[2007-09-08 17:14:41] tobias382 at gmail dot com
Description:
------------
When using any of the various methods of binding parameter values, a
query produces no results. When including the parameter value directly
in the query string, the query does produce results.
Reproduce code:
---------------
$db = new PDO('oci://localhost/XE', '------', '-----');
$id = 'Wilson';
$sql = 'SELECT C.* FROM BreadCrumbLinks B, BreadCrumbLinks C WHERE
B.Lft BETWEEN C.Lft AND C.Rgt AND B.SiteAreaName = :id ORDER BY C.Lft';
$stmt = $db->prepare($sql);
$stmt->bindValue(':id', $id, PDO::PARAM_STR); // Also tried without
typecasting and without a colon in the parameter name
$stmt->execute(); // also tried with an associative array of parameters
and an enumerated array using ? in place of :id in the query
print_r($stmt->fetchAll());
$sql = 'SELECT C.* FROM BreadCrumbLinks B, BreadCrumbLinks C WHERE
B.Lft BETWEEN C.Lft AND C.Rgt AND B.SiteAreaName = \'' . $id . '\' ORDER
BY C.Lft';
$stmt = $db->prepare($sql);
$stmt->execute();
print_r($stmt->fetchAll());
Expected result:
----------------
Array
(
[0] => Array
(
[SITEAREANAME] => Home
[0] => Home
[SITEAREAURL] => Default.aspx
[1] => Default.aspx
[LFT] => 1
[2] => 1
[RGT] => 24
[3] => 24
)
)
Array
(
[0] => Array
(
[SITEAREANAME] => Home
[0] => Home
[SITEAREAURL] => Default.aspx
[1] => Default.aspx
[LFT] => 1
[2] => 1
[RGT] => 24
[3] => 24
)
)
Actual result:
--------------
Array
(
)
Array
(
[0] => Array
(
[SITEAREANAME] => Home
[0] => Home
[SITEAREAURL] => Default.aspx
[1] => Default.aspx
[LFT] => 1
[2] => 1
[RGT] => 24
[3] => 24
)
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42598&edit=1