php-doc-en/reference/cubrid/functions/cubrid-data-seek.xml
2010-09-08 01:27:51 +00:00

115 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.cubrid-data-seek" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_data_seek</refname>
<refpurpose>Moves the internal row pointer of the CUBRID result</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_data_seek</methodname>
<methodparam><type>resource</type><parameter>req_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
</methodsynopsis>
<para>
This function performs the moving of the internal row pointer of the CUBRID result (associated with the specified result identifier) to point to a specific row number. There are functions, such as <function>cubrid_fetch_assoc</function>, which use the current stored value of <parameter>row number</parameter>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>req_identifier</parameter></term>
<listitem><para>This is the request identifier.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>row_number</parameter></term>
<listitem><para>This is the desired row number of the new result pointer.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
CUBRID_CURSOR_SUCCESS, on success.
</para>
<para>
CUBRID_NO_MORE_DATA, when it is not a valid cursor location.
</para>
<para>
&false; on CAS error, row count is 0, or invalid offset.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>cubrid_data_seek</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = cubrid_connect("localhost", 30000, "demodb2", "dba", "");
if (!$link)
{
die('Could not connect.');
}
$query = 'SELECT name, address, salary FROM employees';
$result = cubrid_execute($link, $query);
if ($result)
{
echo "seek to row 0 and fetching fields: ";
cubrid_data_seek($result, 0);
$row = cubrid_fetch_assoc($result);
echo $row["name"]."|". $row["address"]."|".$row["salary"]."<br>";
echo "seek to row 2 and fetching fields: ";
cubrid_data_seek($result, 2);
$row = cubrid_fetch_assoc($result);
echo $row["name"]."|". $row["address"]."|".$row["salary"]."<br>";
cubrid_close_request($result);
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Result:
seek to row 0 and fetching fields: Peter|1st Avenue, New York|1000.0000000000000000
seek to row 2 and fetching fields: Peter Norton|81254, CA|19834.0000000000000000
]]>
</screen>
</example>
</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:"~/.phpdoc/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
-->