PHP: pg_last_notice - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

pg_last_oid pg_last_error

Last updated: Sat, 27 Jan 2007

view this page in

# pg_last_notice

(PHP 4 >= 4.0.6, PHP 5)

pg_last_notice -- Returns the last notice message from PostgreSQL server

## Описание

string pg_last_notice ( resource connection )

pg_last_notice() returns the last notice message from the PostgreSQL server on the specified `connection`. The PostgreSQL server sends notice 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 or not the notice is related to your transaction.

Внимание

This function is EXPERIMENTAL and it is not fully implemented yet. pg_last_notice() was added in PHP 4.0.6. However, PHP 4.0.6 has problem with notice message handling. Use of the PostgreSQL module with PHP 4.0.6 is not recommended even if you are not using pg_last_notice().

This function is fully implemented in PHP 4.3.0. PHP earlier than PHP 4.3.0 ignores database connection parameter.

Notice message tracking can be set to optional by setting 1 for `pgsql.ignore_notice` in `php.ini` from PHP 4.3.0.

Notice message logging can be set to optional by setting 0 for `pgsql.log_notice` in `php.ini` from PHP 4.3.0. Unless `pgsql.ignore_notice` is set to 0, notice message cannot be logged.

## Список параметров

`connection`

  PostgreSQL database connection resource.

## Возвращаемые значения

A string containing the last notice on the given `connection`, or `FALSE` on error.

## Примеры

Пример 1. pg_last_error() example

`<?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;
?>`

Результат выполнения данного примера:

    CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"

## Смотрите также

pg_query()
pg_last_error()

add a note User Contributed Notes
pg_last_notice
There are no user contributed notes for this page.
pg_last_oid pg_last_error

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST