mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +00:00

- All id attributes are now xml:id - Add docbook namespace to all root elements - Replace <ulink /> with <link xlink:href /> - Minor markup fixes here and there git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
225 lines
6 KiB
XML
225 lines
6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<refentry xml:id="function.oci-fetch-array" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>oci_fetch_array</refname>
|
|
<refpurpose>Returns the next row from the result data as an associative or
|
|
numeric array, or both
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>oci_fetch_array</methodname>
|
|
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Returns an array, which corresponds to the next result row.
|
|
</para>
|
|
&oci.datatypes;
|
|
<para>
|
|
It should be mentioned here, that <function>oci_fetch_array</function>
|
|
is <emphasis>insignificantly</emphasis> slower, than
|
|
<function>oci_fetch_row</function>, but much more handy.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>statement</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A valid OCI statement identifier.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>statement</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
An optional second parameter can be any combination of the following
|
|
constants:
|
|
<simplelist>
|
|
<member>
|
|
<constant>OCI_BOTH</constant> - return an array with both associative
|
|
and numeric indices (the same as <constant>OCI_ASSOC</constant>
|
|
+ <constant>OCI_NUM</constant>). This is the default behavior.
|
|
</member>
|
|
<member>
|
|
<constant>OCI_ASSOC</constant> - return an associative array
|
|
(as <function>oci_fetch_assoc</function> works).
|
|
</member>
|
|
<member>
|
|
<constant>OCI_NUM</constant> - return a numeric array,
|
|
(as <function>oci_fetch_row</function> works).
|
|
</member>
|
|
<member>
|
|
<constant>OCI_RETURN_NULLS</constant> - create empty elements
|
|
for the &null; fields.
|
|
</member>
|
|
<member>
|
|
<constant>OCI_RETURN_LOBS</constant> - return the value of a LOB
|
|
of the descriptor.
|
|
</member>
|
|
</simplelist>
|
|
Default <parameter>mode</parameter> is <constant>OCI_BOTH</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns an array with both associative and numeric indices, or &false; if
|
|
there are no more rows in the <parameter>statement</parameter>.
|
|
</para>
|
|
&database.fetch-null;
|
|
<note>
|
|
<simpara>
|
|
Oracle returns all field names in uppercase and associative indices in
|
|
the result array will be uppercased too.
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>oci_fetch_array</function> with <constant>OCI_BOTH</constant> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$connection = oci_connect("apelsin", "kanistra");
|
|
|
|
$query = "SELECT id, name FROM fruits";
|
|
|
|
$statement = oci_parse ($connection, $query);
|
|
oci_execute ($statement);
|
|
|
|
while ($row = oci_fetch_array ($statement, OCI_BOTH)) {
|
|
echo $row[0]." and ".$row['ID']." is the same<br>";
|
|
echo $row[1]." and ".$row['NAME']." is the same<br>";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>oci_fetch_array</function> with
|
|
<constant>OCI_NUM</constant> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$connection = oci_connect("user", "password");
|
|
|
|
$query = "SELECT id, name, lob_field FROM fruits";
|
|
|
|
$statement = oci_parse ($connection, $query);
|
|
oci_execute ($statement);
|
|
|
|
while ($row = oci_fetch_array ($statement, OCI_NUM)) {
|
|
echo $row[0]."<br>";
|
|
echo $row[1]."<br>";
|
|
echo $row[2]->read(100)."<br>"; //this will output first 100 bytes from LOB
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>oci_fetch_array</function> with
|
|
<constant>OCI_ASSOC</constant> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$connection = oci_connect("user", "password");
|
|
|
|
$query = "SELECT id, name, lob_field FROM fruits";
|
|
|
|
$statement = oci_parse ($connection, $query);
|
|
oci_execute ($statement);
|
|
|
|
while ($row = oci_fetch_array ($statement, OCI_ASSOC)) {
|
|
echo $row['ID']."<br>";
|
|
echo $row['NAME']."<br>";
|
|
echo $row['LOB_FIELD']."<br>"; //this will output "Object id #1"
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>oci_fetch_array</function> with
|
|
<constant>OCI_RETURN_LOBS</constant> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$connection = oci_connect("user", "password");
|
|
|
|
$query = "SELECT id, name, lob_field FROM fruits";
|
|
|
|
$statement = oci_parse ($connection, $query);
|
|
oci_execute ($statement);
|
|
|
|
while ($row = oci_fetch_array ($statement, (OCI_NUM+OCI_RETURN_LOBS))) {
|
|
echo $row[0]."<br>";
|
|
echo $row[1]."<br>";
|
|
echo $row['LOB_FIELD']."<br>"; //this will output LOB's content
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>oci_fetch_assoc</function></member>
|
|
<member><function>oci_fetch_object</function></member>
|
|
<member><function>oci_fetch_row</function></member>
|
|
<member><function>oci_fetch_all</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|
|
|