php-doc-en/reference/sesam/functions/sesam-fetch-result.xml
Jakub Vrana 647ee5c6a2 Nuke tabs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@165127 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-03 17:25:34 +00:00

114 lines
3.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/sesam.xml, last change in rev 1.1 -->
<refentry id="function.sesam-fetch-result">
<refnamediv>
<refname>sesam_fetch_result</refname>
<refpurpose>Return all or part of a query result</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>sesam_fetch_result</methodname>
<methodparam><type>string</type><parameter>result_id</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>max_rows</parameter></methodparam>
</methodsynopsis>
<para>
Returns a mixed array with the query result entries, optionally
limited to a maximum of <parameter>max_rows</parameter> rows.
Note that both row and column indexes are zero-based.
<table>
<title>
Mixed result set returned by <function>sesam_fetch_result</function>
</title>
<tgroup cols="2">
<thead>
<row>
<entry>Array Element</entry>
<entry>Contents</entry>
</row>
</thead>
<tbody>
<row>
<entry>int $arr["count"]</entry>
<entry>
number of columns in result set (or zero if this was an
"immediate" query)
</entry>
</row>
<row>
<entry>int $arr["rows"]</entry>
<entry>
number of rows in result set (between zero and
<parameter>max_rows</parameter>)
</entry>
</row>
<row>
<entry>bool $arr["truncated"]</entry>
<entry>
&true; if the number of rows was at least
<parameter>max_rows</parameter>, &false;
otherwise. Note that even when this is
&true;, the next
<function>sesam_fetch_result</function> call may return zero
rows because there are no more result entries.
</entry>
</row>
<row>
<entry>mixed $arr[col][row]</entry>
<entry>
result data for all the fields at
row(<literal>row</literal>) and
column(<literal>col</literal>), (where the integer index
<literal>row</literal> is between 0 and
<literal>$arr["rows"]-1</literal>, and
<literal>col</literal> is between 0 and
<literal>$arr["count"]-1</literal>). Fields may be empty, so
you must check for the existence of a field by using the php
<function>isset</function> function. The type of the
returned fields depend on the respective SQL type declared
for its column (see <link linkend="ref.sesam">SESAM
overview</link> for the conversions applied). SESAM
"multiple fields" are "inlined" and treated like a sequence
of columns.
</entry>
</row>
</tbody>
</tgroup>
</table>
Note that the amount of memory used up by a large query may be
gigantic. Use the <parameter>max_rows</parameter> parameter to
limit the maximum number of rows returned, unless you are
absolutely sure that your result will not use up all available
memory.
</para>
<para>
See also: <function>sesam_fetch_row</function>, and
<function>sesam_field_array</function> to check for "multiple
fields". See the description of the
<function>sesam_query</function> function for a complete example
using <function>sesam_fetch_result</function>.
</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
-->