php-doc-en/reference/ifx/functions/ifx-affected-rows.xml
Hartmut Holzgraefe 5b9fc29465 revision tags added
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78496 c90b9560-bf6c-de11-be94-00142212c4b1
2002-04-17 06:45:35 +00:00

79 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/ifx.xml, last change in rev 1.2 -->
<refentry id="function.ifx-affected-rows">
<refnamediv>
<refname>ifx_affected_rows</refname>
<refpurpose>Get number of rows affected by a query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ifx_affected_rows</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
<parameter>result_id</parameter> is a valid result id returned by
<function>ifx_query</function> or
<function>ifx_prepare</function>.
</para>
<para>
Returns the number of rows affected by a query associated with
<parameter>result_id</parameter>.
</para>
<para>
For inserts, updates and deletes the number is the real number
(sqlerrd[2]) of affected rows. For selects it is an estimate
(sqlerrd[0]). Don't rely on it. The database server can never
return the actual number of rows that will be returned by a
SELECT because it has not even begun fetching them at this stage
(just after the "PREPARE" when the optimizer has determined the
query plan).
</para>
<para>
Useful after <function>ifx_prepare</function> to limit queries to
reasonable result sets.
</para>
<para>
See also: <function>ifx_num_rows</function>
</para>
<example>
<title>Informix affected rows</title>
<programlisting role="php">
<![CDATA[
$rid = ifx_prepare ("select * from emp
where name like " . $name, $connid);
if (! $rid) {
... error ...
}
$rowcount = ifx_affected_rows ($rid);
if ($rowcount > 1000) {
printf ("Too many rows in result set (%d)\n<br>", $rowcount);
die ("Please restrict your query<br>\n");
}
]]>
</programlisting>
</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:"../../../../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
-->