ID: 47189
Updated by: sixd@php.net
Reported By: pcdinh at gmail dot com
Status: Open
-Bug Type: OCI8 related
+Bug Type: Documentation problem
Operating System: Windows XP SP2
PHP Version: 5.3.0alpha3
New Comment:
It is expected that oci_fetch_all() can only be used once. It fetches
all requested rows from the DB and closes the query. Even with $maxrows
>= 1 it cannot be called multiple times after an oci_execute() to get
"pages" of rows.
Previous Comments:
------------------------------------------------------------------------
[2009-01-22 07:46:57] pcdinh at gmail dot com
Description:
------------
I don't know if it is a documentation problem or OCI8-related bug. I
find that oci_fetch_all() always returns empty arrays on subsequent
calls on the same statement handler. PHP Manual does not say anything
about it.
Reproduce code:
---------------
<?php
include_once './dbconfig.php'; // $config is defined here
$connection = oci_connect($config['dbuser'], $config['dbpassword'],
$config['db']);
$stmt = oci_parse($connection, "SELECT 1 FROM dual WHERE 1 =
:value");
$i = 1;
oci_bind_by_name($stmt, ':value', $i, -1, SQLT_INT);
oci_execute($stmt);
oci_fetch_all($stmt, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($rs).'<br />'; // full-data array
oci_fetch_all($stmt, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($rs1); // empty array
oci_free_statement($stmt);
oci_close($connection);
?>
Expected result:
----------------
If it is OCI8-related bug, oci_fetch_all should return the same data
array on multiple calls.
If it is an undocumented behavior, could you please add a
note about it in PHP Manual ?
Actual result:
--------------
oci_fetch_all() always returns empty arrays on subsequent calls on
the same statement handler
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47189&edit=1