- Convert more pgsql docs to new docs style. Add undocumented constant. Update reference.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183634 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christopher Kings-Lynne 2005-04-05 05:55:14 +00:00
parent 93137cbeaa
commit 2c48aaf9a9
8 changed files with 341 additions and 81 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<section id="pgsql.constants">
&reftitle.constants;
&extension.constants;
@ -41,6 +41,18 @@
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PGSQL_CONNECT_FORCE_NEW</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Passed to <function>pg_connect</function> to force the creation of a new connection,
rather then re-using an existing identical connection.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PGSQL_CONNECTION_BAD</constant>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-affected-rows">
<refnamediv>
@ -15,23 +15,9 @@
</methodsynopsis>
<para>
<function>pg_affected_rows</function> returns the number of tuples
(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> example</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>
(instances/records/rows) affected by <literal>INSERT</literal>,
<literal>UPDATE</literal>, and <literal>DELETE</literal>
queries.
</para>
<note>
<para>
@ -40,11 +26,64 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
<para>
PostgreSQL query result resource, returned by <function>pg_query</function>,
<function>pg_query_params</function> or <function>pg_execute</function>
(among others).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of rows affected by the query. If no tuple is
affected, it will return 0.</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_affected_rows</function> example</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>

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.16 -->
<refentry id="function.pg-client-encoding">
<refnamediv>
@ -16,20 +16,19 @@
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
PostgreSQL supports automatic character set conversion between
server and client for certain character sets.
<function>pg_client_encoding</function> returns the client
encoding as the string. The returned string should be either :
SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT, SJIS, BIG5,
WIN1250.
encoding as a string. The returned string will be one of the
standard PostgreSQL encoding identifiers.
</para>
<note>
<para>
This function requires PHP-4.0.3 or higher and PostgreSQL-7.0 or
This function requires PHP 4.0.3 or higher and PostgreSQL 7.0 or
higher. If libpq is compiled without multibyte encoding support,
<function>pg_set_client_encoding</function> always return
&quot;SQL_ASCII&quot;. Supported encoding depends on PostgreSQL
version. Refer to PostgreSQL manual for details to enable
multibyte support and encoding supported.
<function>pg_set_client_encoding</function> always returns
<literal>SQL_ASCII</literal>. Supported encoding depends on PostgreSQL
version. Refer to the PostgreSQL Documentation supported encodings.
</para>
<para>
The function used to be called <function>pg_clientencoding</function>.
@ -37,6 +36,57 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource. When
<parameter>connection</parameter> is not present, the default connection
is used. The default connection is the last connection made by
<function>pg_connect</function> or <function>pg_pconnect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The client encoding, or &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_client_encoding</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Assume $conn is a connection to a ISO-8859-1 database
$encoding = pg_client_encoding($conn);
echo "Client encoding is: ", $encoding, "\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Client encoding is: ISO-8859-1
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id="function.pg-close">
<refnamediv>
@ -16,7 +16,7 @@
<para>
<function>pg_close</function> closes the non-persistent
connection to a PostgreSQL database associated with the given
<parameter>connection</parameter> resource. &return.success;
<parameter>connection</parameter> resource.
</para>
<note>
<para>
@ -31,6 +31,32 @@
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
PostgreSQL database connection resource. When
<parameter>connection</parameter> is not present, the default connection
is used. The default connection is the last connection made by
<function>pg_connect</function> or <function>pg_pconnect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; on success, &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
@ -39,16 +65,31 @@
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Connected successfully
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-connect">
<refnamediv>
@ -14,38 +14,17 @@
<methodparam><type>string</type><parameter>connection_string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>connect_type</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_connect</function> returns a connection resource
that is needed by other PostgreSQL functions.
</para>
<para>
<function>pg_connect</function> opens a connection to a
PostgreSQL database specified by the
<parameter>connection_string</parameter>. It returns a connection
resource on success. It returns &false; if the connection could
not be made. <parameter>connection_string</parameter> should be
a quoted string.
</para>
<para>
The arguments available for
<parameter>connection_string</parameter> includes
<parameter>host</parameter>, <parameter>hostaddr</parameter>, <parameter>port</parameter>,
<parameter>dbname</parameter>, <parameter>user</parameter>,
<parameter>password</parameter>, <parameter>connect_timeout</parameter>,
<parameter>options</parameter>, <parameter>tty</parameter> (ignored), <parameter>sslmode</parameter>,
<parameter>requiressl</parameter> (deprecated in favor of <parameter>sslmode</parameter>), and
<parameter>service</parameter>. Which of these arguments exist depends
on your PostgreSQL version.
<parameter>connection_string</parameter>.
</para>
<para>
If a second call is made to <function>pg_connect</function> with
the same <parameter>connection_string</parameter>, no
new connection will be established unless you pass
the same <parameter>connection_string</parameter> as an existing connection, the
existing connection will be returned unless you pass
<constant>PGSQL_CONNECT_FORCE_NEW</constant> as
<parameter>connect_type</parameter>, 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 strings.
<parameter>connect_type</parameter>.
</para>
<para>
The old syntax with multiple parameters
@ -54,6 +33,55 @@
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection_string</parameter></term>
<listitem>
<para>
The <parameter>connection_string</parameter> can be empty to use all default parameters, or it
can contain one or more parameter settings separated by whitespace.
Each parameter setting is in the form <literal>keyword = value</literal>. Spaces around
the equal sign are optional. To write an empty value or a value
containing spaces, surround it with single quotes, e.g., <literal>keyword =
'a value'</literal>. Single quotes and backslashes within the value must be
escaped with a backslash, i.e., \' and \\.
</para>
<para>
The currently recognized parameter keywords are:
<parameter>host</parameter>, <parameter>hostaddr</parameter>, <parameter>port</parameter>,
<parameter>dbname</parameter>, <parameter>user</parameter>,
<parameter>password</parameter>, <parameter>connect_timeout</parameter>,
<parameter>options</parameter>, <parameter>tty</parameter> (ignored), <parameter>sslmode</parameter>,
<parameter>requiressl</parameter> (deprecated in favor of <parameter>sslmode</parameter>), and
<parameter>service</parameter>. Which of these arguments exist depends
on your PostgreSQL version.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>connect_type</parameter></term>
<listitem>
<para>
If <constant>PGSQL_CONNECT_FORCE_NEW</constant> is passed, then a new connection
is created, even if the <parameter>connection_string</parameter> is identical to
an existing connection.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
PostgreSQL connection resource on success, &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View file

@ -1,10 +1,10 @@
<?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.2 -->
<refentry id="function.pg-num-fields">
<refnamediv>
<refname>pg_num_fields</refname>
<refpurpose>Returns the number of fields</refpurpose>
<refpurpose>Returns the number of fields in a result</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -15,10 +15,7 @@
</methodsynopsis>
<para>
<function>pg_num_fields</function> returns the number of fields
(columns) in a PostgreSQL <parameter>result</parameter>. The
argument is a result resource returned by
<function>pg_query</function>. This function will return -1 on
error.
(columns) in a PostgreSQL result resource.
</para>
<note>
<para>
@ -27,6 +24,57 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
<para>
PostgreSQL query result resource, returned by <function>pg_query</function>,
<function>pg_query_params</function> or <function>pg_execute</function>
(among others).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of fields (columns) in the result. On error, -1 is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_num_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = pg_query($conn, "SELECT 1, 2");
$num = pg_num_fields($result);
echo $num . " field(s) returned.\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
2 field(s) returned.
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,10 +1,10 @@
<?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.2 -->
<refentry id="function.pg-num-rows">
<refnamediv>
<refname>pg_num_rows</refname>
<refpurpose>Returns the number of rows</refpurpose>
<refpurpose>Returns the number of rows in a result</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -15,17 +15,8 @@
</methodsynopsis>
<para>
<function>pg_num_rows</function> will return the number of rows in
a PostgreSQL <parameter>result</parameter> resource.
<parameter>result</parameter> is a query result resource returned
by <function>pg_query</function>. This function will return -1 on
error.
a PostgreSQL result resource.
</para>
<note>
<para>
Use <function>pg_affected_rows</function> to get number of rows
affected by INSERT, UPDATE and DELETE query.
</para>
</note>
<note>
<para>
This function used to be called <literal>pg_numrows()</literal>.
@ -33,6 +24,57 @@
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
<para>
PostgreSQL query result resource, returned by <function>pg_query</function>,
<function>pg_query_params</function> or <function>pg_execute</function>
(among others).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of rows in the result. On error, -1 is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_num_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$result = pg_query($conn, "SELECT 1");
$rows = pg_num_rows($result);
echo $rows . " row(s) returned.\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
1 row(s) returned.
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.23 $ -->
<!-- $Revision: 1.24 $ -->
<reference id="ref.pgsql">
<title>PostgreSQL Functions</title>
<titleabbrev>PostgreSQL</titleabbrev>
@ -22,7 +22,7 @@
&reftitle.required;
<para>
To use PostgreSQL support, you need PostgreSQL 6.5 or
later, PostgreSQL 7.4 or later to enable all PostgreSQL module
later, PostgreSQL 8.0 or later to enable all PostgreSQL module
features. PostgreSQL supports many character encoding including
multibyte character encoding. The current version and more
information about PostgreSQL is available at