mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Multiple statements example & transaction explanations added (Bug #34719).
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@197546 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
cf05ac7d25
commit
31089b442d
1 changed files with 26 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-query">
|
||||
<refnamediv>
|
||||
|
@ -64,7 +64,9 @@
|
|||
<term><parameter>query</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The SQL statement or statements to be executed.
|
||||
The SQL statement or statements to be executed. When multiple statements are passed to the function,
|
||||
they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands
|
||||
included in the query string. However, using multiple transactions in one function call is not recommended.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -105,6 +107,28 @@ while ($row = pg_fetch_row($result)) {
|
|||
echo "<br />\n";
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Using pg_query() with multiple statements</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$conn = pg_pconnect("dbname=publisher");
|
||||
|
||||
// these statements will be executed as one transaction
|
||||
|
||||
$query = "UPDATE authors SET author=UPPER(author) WHERE id=1;";
|
||||
$query .= "UPDATE authors SET author=LOWER(author) WHERE id=2;";
|
||||
$query .= "UPDATE authors SET author=NULL WHERE id=3;";
|
||||
|
||||
pg_query($conn, $query);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue