#47189 [Opn->Csd]: oci_fetch_all() returns empty arrays on subsequent call on a given statement
ID: 47189
Updated by: vrana@php.net
Reported By: pcdinh at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows XP SP2
PHP Version: 5.3.0alpha3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-11-20 10:45:12] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=291058
Log: Call once (bug #47189)
------------------------------------------------------------------------
[2009-01-23 00:38:51] sixd@php.net
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.
------------------------------------------------------------------------
[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
Thread (2 messages)