PHP ��U
前一頁 |  | 下一頁

# 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.

警告
�o�Ө�ƬO����ʽ��C�o�Ө�ƪ�欰�B�W�١B�M����ƪ����L���b��PHP�o�椤�i��|�b�q�p�U���ܡC �ϥΦ��ݦۦ�Ӿ᭷�I�C

## Parameters

connection

  PostgreSQL database connection resource.

table_name

  The name of the table.

## Return Values

An array of the table definition, or `FALSE` on error.

## �d��

範例 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 will 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)
    }
    }

## �Ѧ�

pg_convert()

前一頁 | 內容 | 下一頁
pg_lo_write | 上一層 | pg_num_fields