update : 2015.11.03
php.shukuma.com

검색:
 
 
Returns the last notice message from PostgreSQL server

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.

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

Notice message logging can be set to optional by setting 0 for pgsql.log_notice in php.ini. 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.

예제

Example #1 pg_last_notice() 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"

참고