php-doc-en/reference/ifx/functions/ifx-affected-rows.xml
Daniel Egeberg 96c9d88bad Converted to utf-8
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
2010-03-28 22:10:10 +00:00

113 lines
2.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.ifx-affected-rows" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ifx_affected_rows</refname>
<refpurpose>Get number of rows affected by a query</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>ifx_affected_rows</methodname>
<methodparam><type>resource</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<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>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result_id</parameter></term>
<listitem>
<para>
A valid result id returned by <function>ifx_query</function> or
<function>ifx_prepare</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of rows as an integer.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Informix affected rows</title>
<programlisting role="php">
<![CDATA[
<?php
$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>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ifx_num_rows</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:"~/.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
-->