#47189 [Opn]: oci_fetch_all() returns empty arrays on subsequent call on a given statement

From: Date: Fri, 23 Jan 2009 00:38:54 +0000
Subject: #47189 [Opn]: oci_fetch_all() returns empty arrays on subsequent call on a given statement
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1743@lists.php.net to get a copy of this message
 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



Thread (2 messages)

« previous php.doc.bugs (#1743) next »