ID: 35421
Updated by: [EMAIL PROTECTED]
Reported By: hellower at nate dot com
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: windows 2000
PHP Version: 5.1.0
New Comment:
Use $sth->errorInfo() to get the error message if $sth->execute()
fails.
Hint: ROWNUM is a reserved word in Oracle.
No bug here.
Previous Comments:
------------------------------------------------------------------------
[2005-11-27 08:42:54] hellower at nate dot com
.
------------------------------------------------------------------------
[2005-11-27 08:35:11] hellower at nate dot com
Description:
------------
when I use "ROWNUM" as bind variable name,
the query result set doesn't appeared.
db: oracle 8.1.7.4
db os: aix 5.3
webserver: apache 2.0.55
webserver os: winows 2000
php : 5.1.0
Reproduce code:
---------------
<?php
$dbh = new PDO("oci:dbname=sslgm166_8174", 'XXX',
'XXX',array(PDO::ATTR_PERSISTENT => true));
echo "<pre>";
$sql = 'select * from tab where rownum < :ROWNU';
$sth = $dbh->prepare($sql);
$sth->execute(array(':ROWNU' => 2));
$result = $sth->fetchAll();
print_r($result);
echo "<hr>";
$sql = 'select * from tab where rownum < :ROWNUM';
$sth = $dbh->prepare($sql);
$sth->execute(array(':ROWNUM' => 2));
$result = $sth->fetchAll();
print_r($result);
echo "</pre>";
?>
Expected result:
----------------
Array
(
[0] => Array
(
[TNAME] => CREDITS
[0] => CREDITS
[TABTYPE] => TABLE
[1] => TABLE
[CLUSTERID] =>
[2] =>
)
)
-----------------------------------------
Array
(
[0] => Array
(
[TNAME] => CREDITS
[0] => CREDITS
[TABTYPE] => TABLE
[1] => TABLE
[CLUSTERID] =>
[2] =>
)
)
Actual result:
--------------
Array
(
[0] => Array
(
[TNAME] => CREDITS
[0] => CREDITS
[TABTYPE] => TABLE
[1] => TABLE
[CLUSTERID] =>
[2] =>
)
)
-----------------------------------------
Array <------------------- EMPTY ARRAY !!!
(
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35421&edit=1