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
152 lines
4.3 KiB
XML
152 lines
4.3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.4 $ -->
|
|
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
|
<refentry xml:id="function.db2-fetch-object" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>db2_fetch_object</refname>
|
|
<refpurpose>
|
|
Returns an object with properties representing columns in the fetched row
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>object</type><methodname>db2_fetch_object</methodname>
|
|
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>row_number</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
|
|
<para>
|
|
Returns an object in which each property represents a column returned in
|
|
the row fetched from a result set.
|
|
</para>
|
|
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>stmt</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A valid <literal>stmt</literal> resource containing a result set.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>row_number</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Requests a specific 1-indexed row from the result set. Passing this
|
|
parameter results in a PHP warning if the result set uses a
|
|
forward-only cursor.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns an object representing a single row in the result set. The
|
|
properties of the object map to the names of the columns in the result set.
|
|
</para>
|
|
<para>
|
|
The IBM DB2, Cloudscape, and Apache Derby database servers typically fold
|
|
column names to upper-case, so the object properties will reflect that case.
|
|
</para>
|
|
<para>
|
|
If your SELECT statement calls a scalar function to modify the value
|
|
of a column, the database servers return the column number as the name of
|
|
the column in the result set. If you prefer a more descriptive column name
|
|
and object property, you can use the AS clause to assign a name to the
|
|
column in the result set.
|
|
</para>
|
|
<para>
|
|
Returns &false; if no row was retrieved.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>A <function>db2_fetch_object</function> example</title>
|
|
<para>
|
|
The following example issues a SELECT statement with a scalar function,
|
|
RTRIM, that removes whitespace from the end of the column. Rather than
|
|
creating an object with the properties "BREED" and "2", we use the AS
|
|
clause in the SELECT statement to assign the name "name" to the modified
|
|
column. The database server folds the column names to upper-case,
|
|
resulting in an object with the properties "BREED" and "NAME".
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = db2_connect($database, $user, $password);
|
|
|
|
$sql = "SELECT breed, RTRIM(name) AS name
|
|
FROM animals
|
|
WHERE id = ?";
|
|
|
|
if ($conn) {
|
|
$stmt = db2_prepare($conn, $sql);
|
|
db2_execute($stmt, array(0));
|
|
|
|
while ($pet = db2_fetch_object($stmt)) {
|
|
echo "Come here, {$pet->NAME}, my little {$pet->BREED}!";
|
|
}
|
|
db2_close($conn);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Come here, Pook, my little cat!
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>db2_fetch_array</function></member>
|
|
<member><function>db2_fetch_assoc</function></member>
|
|
<member><function>db2_fetch_both</function></member>
|
|
<member><function>db2_fetch_row</function></member>
|
|
<member><function>db2_result</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
|
|
-->
|