chriskl Mon Jul 4 00:44:22 2005 EDT
Modified files:
/phpdoc/en/reference/pgsql/functions pg-get-notify.xml
pg-last-error.xml
pg-last-notice.xml
pg-last-oid.xml
Log:
Convert several more pgsql doc pages to the new format.
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-get-notify.xml?r1=1.13&r2=1.14&ty=u
Index: phpdoc/en/reference/pgsql/functions/pg-get-notify.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-get-notify.xml:1.13
phpdoc/en/reference/pgsql/functions/pg-get-notify.xml:1.14
--- phpdoc/en/reference/pgsql/functions/pg-get-notify.xml:1.13 Sun Jul 3
08:27:09 2005
+++ phpdoc/en/reference/pgsql/functions/pg-get-notify.xml Mon Jul 4
00:44:21 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.13 $ -->
+<!-- $Revision: 1.14 $ -->
<refentry id="function.pg-get-notify">
<refnamediv>
<refname>pg_get_notify</refname>
@@ -21,7 +21,7 @@
</para>
</refsect1>
-<refsect1 role="parameters">
+ <refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-last-error.xml?r1=1.7&r2=1.8&ty=u
Index: phpdoc/en/reference/pgsql/functions/pg-last-error.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-last-error.xml:1.7
phpdoc/en/reference/pgsql/functions/pg-last-error.xml:1.8
--- phpdoc/en/reference/pgsql/functions/pg-last-error.xml:1.7 Thu Apr 21
05:29:05 2005
+++ phpdoc/en/reference/pgsql/functions/pg-last-error.xml Mon Jul 4
00:44:21 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-last-error">
<refnamediv>
@@ -15,15 +15,15 @@
</methodsynopsis>
<para>
<function>pg_last_error</function> returns the last error message
- for given <parameter>connection</parameter>.
+ for a given <parameter>connection</parameter>.
</para>
<para>
- Error messages may be overwritten by internal PostgreSQL(libpq)
- function calls. It may not return appropriate error message, if
- multiple errors are occurred inside a PostgreSQL module function.
+ Error messages may be overwritten by internal PostgreSQL (libpq)
+ function calls. It may not return an appropriate error message if
+ multiple errors occur inside a PostgreSQL module function.
</para>
<para>
- Use <function>pg_result_error</function>,
+ Use <function>pg_result_error</function>,
<function>pg_result_error_field</function>,
<function>pg_result_status</function> and
<function>pg_connection_status</function> for better error handling.
</para>
@@ -34,11 +34,62 @@
</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>
+ A <type>string</type> containing the last error message on the
+ given <parameter>connection</parameter>, or &false; on error.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>pg_last_error</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$pgsql_conn = pg_connect("dbname=mark host=localhost");
+
+if ($pgsql_conn) {
+ print "Successfully connected to: " . pg_host($pgsql_conn) . "<br/>\n";
+} else {
+ print pg_last_error($pgsql_conn);
+ exit;
+}
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_result_error</function></member>
+ <member><function>pg_result_error_field</function></member>
</simplelist>
</para>
</refsect1>
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-last-notice.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/pgsql/functions/pg-last-notice.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-last-notice.xml:1.5
phpdoc/en/reference/pgsql/functions/pg-last-notice.xml:1.6
--- phpdoc/en/reference/pgsql/functions/pg-last-notice.xml:1.5 Fri Mar 11
11:03:25 2005
+++ phpdoc/en/reference/pgsql/functions/pg-last-notice.xml Mon Jul 4
00:44:21 2005
@@ -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.82 -->
<refentry id="function.pg-last-notice">
<refnamediv>
@@ -17,12 +17,14 @@
</methodsynopsis>
<para>
<function>pg_last_notice</function> returns the last notice
- message from the PostgreSQL server specified by
+ message from the PostgreSQL server on the specified
<parameter>connection</parameter>. The PostgreSQL server sends notice
- messages in several cases, e.g. if the transactions can't be continued.
+ messages in several cases, for instance when creating a
<literal>SERIAL</literal>
+ column in a table.
+ </para>
+ <para>
With <function>pg_last_notice</function>, you can avoid issuing useless
- queries, by checking whether the notice is related to the transaction
- or not.
+ queries by checking whether or not the notice is related to your
transaction.
</para>
<warning>
<para>
@@ -49,7 +51,59 @@
to 0, notice message cannot be logged.
</para>
</refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>connection</parameter></term>
+ <listitem>
+ <para>
+ PostgreSQL database connection resource.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ A <type>string</type> containing the last notice on the
+ given <parameter>connection</parameter>, or &false; on error.
+ </para>
+ </refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>pg_last_error</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ $pgsql_conn = pg_connect("dbname=mark host=localhost");
+
+ $res = pg_query("CREATE TABLE test (id SERIAL)");
+
+ $notice = pg_last_notice($pgsql_conn);
+
+ echo $notice;
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column
"test.id"
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
<refsect1 role="seealso">
&reftitle.seealso;
<para>
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-last-oid.xml?r1=1.8&r2=1.9&ty=u
Index: phpdoc/en/reference/pgsql/functions/pg-last-oid.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-last-oid.xml:1.8
phpdoc/en/reference/pgsql/functions/pg-last-oid.xml:1.9
--- phpdoc/en/reference/pgsql/functions/pg-last-oid.xml:1.8 Fri Jun 24
05:11:45 2005
+++ phpdoc/en/reference/pgsql/functions/pg-last-oid.xml Mon Jul 4 00:44:21 2005
@@ -1,10 +1,10 @@
<?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.82 -->
<refentry id="function.pg-last-oid">
<refnamediv>
<refname>pg_last_oid</refname>
- <refpurpose>Returns the last object's oid</refpurpose>
+ <refpurpose>Returns the last row's OID</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -15,19 +15,21 @@
</methodsynopsis>
<para>
<function>pg_last_oid</function> is used to retrieve the
- <varname>oid</varname> assigned to an inserted tuple (record) if
- the result resource is used from the last command sent via
- <function>pg_query</function> and was an SQL INSERT. Returns a
- positive number if there was a valid <varname>oid</varname>. It
- returns &false; if an error occurs or the last command sent via
- <function>pg_query</function> was not an INSERT or INSERT is
- failed.
+ <varname>OID</varname> assigned to an inserted row.
</para>
<para>
- OID field became an optional field from PostgreSQL 7.2. When
- OID field is not defined in a table, programmer must use
- <function>pg_result_status</function> to check if record
- is inserted successfully or not.
+ OID field became an optional field from PostgreSQL 7.2 and will
+ not be present by default in PostgreSQL 8.1. When the
+ OID field is not present in a table, the programmer must use
+ <function>pg_result_status</function> to check for successful
+ insertion.
+ </para>
+ <para>
+ To get the value of a <literal>SERIAL</literal> field in an inserted
+ row, it is necessary to use the PostgreSQL <literal>CURRVAL</literal>
+ function, naming the sequence whose last value is required. If the
+ name of the sequence is unknown, the
<literal>pg_get_serial_sequence</literal>
+ PostgreSQL 8.0 function is necessary.
</para>
<note>
<para>
@@ -36,6 +38,55 @@
</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>
+ A <type>string</type> containing the OID assigned to the most recently
inserted
+ row in the specified <parameter>connection</parameter>, or &false; on error
or
+ no available OID.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>pg_last_error</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ $pgsql_conn = pg_connect("dbname=mark host=localhost");
+
+ $res1 = pg_query("CREATE TABLE test (a INTEGER) WITH OIDS");
+
+ $res2 = pg_query("INSERT INTO test VALUES (1)");
+
+ $oid = pg_last_oid($res2);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
<refsect1 role="seealso">
&reftitle.seealso;
<para>