1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-24 15:12:20 +01:00
Files
archived-doc-zh/reference/pgsql/functions/pg-affected-rows.xml
魔王卷子 ec1ac8e6b1 Update pgsql 2 (#589)
* Update pg-affected-rows.xml

* Update pg-cancel-query.xml

* Update pg-client-encoding.xml

* Update pg-close.xml
2023-01-01 22:07:47 +08:00

128 lines
3.1 KiB
XML
Executable File

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.pg-affected-rows" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_affected_rows</refname>
<refpurpose>返回受影响的记录数(元组)</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>pg_affected_rows</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_affected_rows</function> 返回受 <literal>INSERT</literal><literal>UPDATE</literal>
<literal>DELETE</literal> 查询影响的元组数(实例/记录/行)。
</para>
<para>
从 PostgreSQL 9.0 及更高版本开始,服务器返回 SELECT 的行数。较旧的 PostgreSQL 则返回 0。
</para>
<note>
<para>
此函数过去称为 <function>pg_cmdtuples</function>
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
&pgsql.parameter.result;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
受查询影响的行数。如果没有元组受到影响,它将返回 <literal>0</literal>
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.result-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_affected_rows</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
$result = pg_query($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows($result);
echo $cmdtuples . " tuples are affected.\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
1 tuples are affected.
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_query</function></member>
<member><function>pg_query_params</function></member>
<member><function>pg_execute</function></member>
<member><function>pg_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
-->