From 205a0648d8468e467c5052aed59f457b921146ac Mon Sep 17 00:00:00 2001 From: Christopher Kings-Lynne Date: Mon, 4 Jul 2005 04:44:21 +0000 Subject: [PATCH] Convert several more pgsql doc pages to the new format. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189845 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pgsql/functions/pg-get-notify.xml | 4 +- reference/pgsql/functions/pg-last-error.xml | 63 ++++++++++++++-- reference/pgsql/functions/pg-last-notice.xml | 64 ++++++++++++++-- reference/pgsql/functions/pg-last-oid.xml | 77 ++++++++++++++++---- 4 files changed, 182 insertions(+), 26 deletions(-) diff --git a/reference/pgsql/functions/pg-get-notify.xml b/reference/pgsql/functions/pg-get-notify.xml index 5391c1216d..8546d56eba 100644 --- a/reference/pgsql/functions/pg-get-notify.xml +++ b/reference/pgsql/functions/pg-get-notify.xml @@ -1,5 +1,5 @@ - + pg_get_notify @@ -21,7 +21,7 @@ - + &reftitle.parameters; diff --git a/reference/pgsql/functions/pg-last-error.xml b/reference/pgsql/functions/pg-last-error.xml index 9c3dd446ae..bc0f66a2ca 100644 --- a/reference/pgsql/functions/pg-last-error.xml +++ b/reference/pgsql/functions/pg-last-error.xml @@ -1,5 +1,5 @@ - + @@ -15,15 +15,15 @@ pg_last_error returns the last error message - for given connection. + for a given connection. - 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. - Use pg_result_error, + Use pg_result_error, pg_result_error_field, pg_result_status and pg_connection_status for better error handling. @@ -34,11 +34,62 @@ + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + + + + + &reftitle.returnvalues; + + A string containing the last error message on the + given connection, or &false; on error. + + + + + &reftitle.examples; + + + <function>pg_last_error</function> example + +\n"; +} else { + print pg_last_error($pgsql_conn); + exit; +} +?> +]]> + + + + + &reftitle.seealso; pg_result_error + pg_result_error_field diff --git a/reference/pgsql/functions/pg-last-notice.xml b/reference/pgsql/functions/pg-last-notice.xml index d3420652f7..7ff1995762 100644 --- a/reference/pgsql/functions/pg-last-notice.xml +++ b/reference/pgsql/functions/pg-last-notice.xml @@ -1,5 +1,5 @@ - + @@ -17,12 +17,14 @@ pg_last_notice returns the last notice - message from the PostgreSQL server specified by + message from the PostgreSQL server on the specified connection. 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 SERIAL + column in a table. + + With pg_last_notice, 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. @@ -49,7 +51,59 @@ to 0, notice message cannot be logged. + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. + + + + + + + + &reftitle.returnvalues; + + A string containing the last notice on the + given connection, or &false; on error. + + + + + &reftitle.examples; + + + <function>pg_last_error</function> example + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-last-oid.xml b/reference/pgsql/functions/pg-last-oid.xml index d1eaa2ee72..952d2dd9e6 100644 --- a/reference/pgsql/functions/pg-last-oid.xml +++ b/reference/pgsql/functions/pg-last-oid.xml @@ -1,10 +1,10 @@ - + pg_last_oid - Returns the last object's oid + Returns the last row's OID @@ -15,19 +15,21 @@ pg_last_oid is used to retrieve the - oid assigned to an inserted tuple (record) if - the result resource is used from the last command sent via - pg_query and was an SQL INSERT. Returns a - positive number if there was a valid oid. It - returns &false; if an error occurs or the last command sent via - pg_query was not an INSERT or INSERT is - failed. + OID assigned to an inserted row. - OID field became an optional field from PostgreSQL 7.2. When - OID field is not defined in a table, programmer must use - pg_result_status 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 + pg_result_status to check for successful + insertion. + + + To get the value of a SERIAL field in an inserted + row, it is necessary to use the PostgreSQL CURRVAL + function, naming the sequence whose last value is required. If the + name of the sequence is unknown, the pg_get_serial_sequence + PostgreSQL 8.0 function is necessary. @@ -36,6 +38,55 @@ + + &reftitle.parameters; + + + + result + + + PostgreSQL query result resource, returned by pg_query, + pg_query_params or pg_execute + (among others). + + + + + + + + + &reftitle.returnvalues; + + A string containing the OID assigned to the most recently inserted + row in the specified connection, or &false; on error or + no available OID. + + + + + &reftitle.examples; + + + <function>pg_last_error</function> example + + +]]> + + + + + &reftitle.seealso;