unified examples, fixed typos, some new examples ...

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@135086 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Cornelia Boenigk 2003-07-14 23:39:08 +00:00
parent 5ce8a02984
commit 9c5df5c037
7 changed files with 82 additions and 19 deletions

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-affected-rows">
<refnamediv>
<refname>pg_affected_rows</refname>
<refpurpose>Returns number of affected records(tuples)</refpurpose>
<refpurpose>Returns number of affected records (tuples)</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@ -17,12 +17,14 @@
(instances/records/rows) affected by INSERT, UPDATE, and DELETE
queries executed by <function>pg_query</function>. If no tuple is
affected by this function, it will return 0.
</para>
<para>
<example>
<title><function>pg_affected_rows</function></title>
<programlisting role="php">
<![CDATA[
<?php
$result = pg_query ($conn, "INSERT INTO publisher VALUES ('Author')");
$result = pg_query ($conn, "INSERT INTO authors VALUES ('Orwell', 2002, 'Animal Farm')");
$cmdtuples = pg_affected_rows ($result);
echo $cmdtuples . " tuples are affected.";
?>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-close">
<refnamediv>
@ -24,6 +24,21 @@
of the script.
</para>
</note>
<para>
<example>
<title>PostgreSQL close example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = $dbconn = pg_connect ("host=localhost port=5432 dbname=mary")
or die("Could not connect);
print ("Connected successfully");
pg_close($dbconn);
?>
]]>
</programlisting>
</example>
</para>
<para>
If there is open large object resource on the connection, do not
close the connection before closing all large object resources.

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-connect">
<refnamediv>
@ -30,10 +30,13 @@
<?php
$dbconn = pg_connect ("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_connect ("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_connect ("host=sheep port=5432 dbname=mary user=lamb password=foo");
//connect to a database named "mary" on the host "sheep" with a username and password
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_connect ($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
@ -54,7 +57,7 @@ $dbconn4 = pg_connect ($conn_string);
new connection will be established, but instead, the connection
resource of the already opened connection will be returned. You
can have multiple connections to the same database if you use
different connection string.
different connection strings.
</para>
<para>
The old syntax with multiple parameters

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id='function.pg-connection-reset'>
<refnamediv>
@ -18,6 +18,25 @@
<function>pg_connection_reset</function> resets the connection.
It is useful for error recovery. &return.success;
</para>
<para>
<example>
<title><function>pg_connection_reset</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
$dbconn2 = pg_connection_reset($dbconn);
if ($dbconn2) {
echo 'reset successful';
}
else {
echo 'reset failed';
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>pg_connect</function>,
<function>pg_pconnect</function> and

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-convert'>
<refnamediv>
@ -18,7 +18,14 @@
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_convert</function> check and convert <literal>assoc_array</literal> suitable for SQL statement.
<function>pg_convert</function> checks and converts the values in
<literal>assoc_array</literal> into suitable values for use in a SQL
statement. Precondition for <function>pg_convert</function> is the existence
of a table <literal>table_name</literal> which has at least as many columns
as <literal>assoc_array</literal> has elements. The fieldnames as well as
the fieldvalues in <literal>table_name</literal> must match the indices and
values of <literal>assoc_array</literal>. Returns an array with the converted
values on success, &false; otherwise.
</para>
<note>
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-dbname">
<refnamediv>
@ -18,6 +18,21 @@
resource. It returns &false;, if <parameter>connection</parameter>
is not a valid PostgreSQL connection resource.
</para>
<para>
<example>
<title><function>pg_dbname</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
error_reporting(E_ALL);
pg_connect ("host=localhost port=5432 dbname=mary");
echo pg_dbname();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
<refentry id='function.pg-insert'>
<refnamediv>
@ -18,21 +18,23 @@
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_insert</function> inserts
<literal>assoc_array</literal> which has
<literal>field=>value</literal> into table specified as
<literal>table_name</literal>. If <literal>options</literal> is
specified, <function>pg_convert</function> is applied
to <literal>assoc_array</literal> with specified option.
<function>pg_insert</function> inserts the values of <literal>assoc_array</literal>
into the table specified by <literal>table_name</literal>.
<literal>table_name</literal> must at least have as many columns as <literal>assoc_array</literal>
has elements. The fieldnames as well as the fieldvalues in <literal>table_name</literal>
must match the indices and values of <literal>assoc_array</literal>.
<function>pg_insert</function> returns &true; on success, &false; on failure.
If options is specified, <function>pg_insert</function> is applied to
<literal>assoc_array</literal> with specified option.
</para>
<example>
<title>pg_insert</title>
<programlisting role="php">
<![CDATA[
<?php
$db = pg_connect ('dbname=foo');
$dbconn = pg_connect ('dbname=foo');
// This is safe, since $_POST is converted automatically
$res = pg_insert($db, 'post_log', $_POST);
$res = pg_insert($dbconn, 'post_log', $_POST);
if ($res) {
echo "POST data is succesfully logged\n";
}