pg_meta_data

(PHP 4 >= 4.3.0, PHP 5)

pg_meta_data --  Get meta data for table.

Description

array pg_meta_data ( resource connection, string table_name)

pg_meta_data() returns table definition for table_name as an array. If there is error, it returns FALSE

예 1. Getting table metadata

<?php
    $dbconn
= pg_connect("dbname=publisher") or die("Could not connect");

    
$meta = pg_meta_data($dbconn, 'authors');
    if (
is_array($meta)) {
        echo
'<pre>';
        
var_dump($meta);
        echo
'</pre>';
    }
?>

The above example would produce the following output:

array(3) {
  ["author"]=>
  array(5) {
    ["num"]=>
    int(1)
    ["type"]=>
    string(7) "varchar"
    ["len"]=>
    int(-1)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
  ["year"]=>
  array(5) {
    ["num"]=>
    int(2)
    ["type"]=>
    string(4) "int2"
    ["len"]=>
    int(2)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
  ["title"]=>
  array(5) {
    ["num"]=>
    int(3)
    ["type"]=>
    string(7) "varchar"
    ["len"]=>
    int(-1)
    ["not null"]=>
    bool(false)
    ["has default"]=>
    bool(false)
  }
}

주의

이 함수는 실험적입니다. 이 함수의 작동, 함수의 이름, 그리고 이 함수에 대해 모든 문서는 이후의 PHP 릴리즈에서 예고 없이 변경할 수 있습니다. 이 함수의 사용에 관한 것은 사용자 책임입니다.

See also pg_convert().