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