1--TEST-- 2PostgreSQL pg_meta_data() - basic test using schema 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php include("inc/skipif.inc"); ?> 7--FILE-- 8<?php 9 10include('inc/config.inc'); 11$schema_name = 'schema_pg_meta_data_001'; 12$table_name = 'table_pg_meta_data_001'; 13 14$conn = pg_connect($conn_str); 15 16pg_query($conn, "CREATE SCHEMA {$schema_name}"); 17 18pg_query($conn, "CREATE TABLE {$schema_name}.{$table_name} (id INT, id2 INT)"); 19 20pg_query($conn, "CREATE TABLE {$table_name} (id INT, id3 INT)"); 21 22 23var_dump(pg_meta_data($conn, $table_name)); 24var_dump(pg_meta_data($conn, "{$schema_name}.{$table_name}")); 25var_dump(pg_meta_data($conn, "{$schema_name}.{$table_name}", TRUE)); 26 27?> 28--CLEAN-- 29<?php 30require_once('inc/config.inc'); 31$schema_name = 'schema_pg_meta_data_001'; 32$table_name = 'table_pg_meta_data_001'; 33 34$conn = pg_connect($conn_str); 35pg_query($conn, "DROP TABLE IF EXISTS {$table_name}"); 36pg_query($conn, "DROP TABLE IF EXISTS {$schema_name}.{$table_name}"); 37pg_query($conn, "DROP SCHEMA IF EXISTS {$schema_name}"); 38?> 39--EXPECT-- 40array(2) { 41 ["id"]=> 42 array(7) { 43 ["num"]=> 44 int(1) 45 ["type"]=> 46 string(4) "int4" 47 ["len"]=> 48 int(4) 49 ["not null"]=> 50 bool(false) 51 ["has default"]=> 52 bool(false) 53 ["array dims"]=> 54 int(0) 55 ["is enum"]=> 56 bool(false) 57 } 58 ["id3"]=> 59 array(7) { 60 ["num"]=> 61 int(2) 62 ["type"]=> 63 string(4) "int4" 64 ["len"]=> 65 int(4) 66 ["not null"]=> 67 bool(false) 68 ["has default"]=> 69 bool(false) 70 ["array dims"]=> 71 int(0) 72 ["is enum"]=> 73 bool(false) 74 } 75} 76array(2) { 77 ["id"]=> 78 array(7) { 79 ["num"]=> 80 int(1) 81 ["type"]=> 82 string(4) "int4" 83 ["len"]=> 84 int(4) 85 ["not null"]=> 86 bool(false) 87 ["has default"]=> 88 bool(false) 89 ["array dims"]=> 90 int(0) 91 ["is enum"]=> 92 bool(false) 93 } 94 ["id2"]=> 95 array(7) { 96 ["num"]=> 97 int(2) 98 ["type"]=> 99 string(4) "int4" 100 ["len"]=> 101 int(4) 102 ["not null"]=> 103 bool(false) 104 ["has default"]=> 105 bool(false) 106 ["array dims"]=> 107 int(0) 108 ["is enum"]=> 109 bool(false) 110 } 111} 112array(2) { 113 ["id"]=> 114 array(11) { 115 ["num"]=> 116 int(1) 117 ["type"]=> 118 string(4) "int4" 119 ["len"]=> 120 int(4) 121 ["not null"]=> 122 bool(false) 123 ["has default"]=> 124 bool(false) 125 ["array dims"]=> 126 int(0) 127 ["is enum"]=> 128 bool(false) 129 ["is base"]=> 130 bool(true) 131 ["is composite"]=> 132 bool(false) 133 ["is pseudo"]=> 134 bool(false) 135 ["description"]=> 136 string(0) "" 137 } 138 ["id2"]=> 139 array(11) { 140 ["num"]=> 141 int(2) 142 ["type"]=> 143 string(4) "int4" 144 ["len"]=> 145 int(4) 146 ["not null"]=> 147 bool(false) 148 ["has default"]=> 149 bool(false) 150 ["array dims"]=> 151 int(0) 152 ["is enum"]=> 153 bool(false) 154 ["is base"]=> 155 bool(true) 156 ["is composite"]=> 157 bool(false) 158 ["is pseudo"]=> 159 bool(false) 160 ["description"]=> 161 string(0) "" 162 } 163} 164