php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47189 oci_fetch_all() returns empty arrays on subsequent call on a given statement
Submitted: 2009-01-22 07:46 UTC Modified: 2009-11-20 10:45 UTC
From: pcdinh at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.3.0alpha3 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2009-01-22 07:46 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-23 00:38 UTC] 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-11-20 10:45 UTC] 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-11-20 10:45 UTC] vrana@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 19:01:34 2024 UTC