pg_meta_data

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

pg_meta_data 锟斤拷帽锟斤拷元锟斤拷锟斤拷

说锟斤拷

pg_meta_data ( resource $connection , string $table_name ) : array

pg_metadata() 锟斤拷锟斤拷锟斤拷锟斤拷式锟斤拷锟斤拷 table_name 锟斤拷亩锟斤拷濉�

Warning

锟剿猴拷锟斤拷锟斤拷实锟斤拷锟斤拷锟侥★拷锟剿猴拷锟斤拷锟侥憋拷锟襟,帮拷锟斤拷锟斤拷锟狡硷拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟� PHP 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷

锟斤拷锟斤拷

connection

PostgreSQL database connection resource.

table_name

The name of the table.

锟斤拷锟斤拷值

锟斤拷锟斤拷锟斤拷 array 锟斤拷式锟斤拷锟截憋拷亩锟斤拷澹拷锟斤拷锟斤拷锟斤拷锟津返伙拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 取锟矫憋拷锟皆拷锟斤拷锟�

<?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>';
  }
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

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() - 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值转锟斤拷为锟绞猴拷 SQL 锟斤拷锟侥革拷式锟斤拷