xref: /php-src/ext/pgsql/tests/11pg_meta_data.phpt (revision c15988aa)
1--TEST--
2PostgreSQL pg_metadata()
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("inc/skipif.inc"); ?>
7--FILE--
8<?php
9error_reporting(E_ALL);
10
11include 'inc/config.inc';
12$table_name = "table_11pg_meta_data";
13
14$db = pg_connect($conn_str);
15pg_query($db, "CREATE TABLE {$table_name} (num int, str text, bin bytea)");
16
17$meta = pg_meta_data($db, $table_name);
18
19var_dump($meta);
20?>
21--CLEAN--
22<?php
23include('inc/config.inc');
24$table_name = "table_11pg_meta_data";
25
26$db = pg_connect($conn_str);
27pg_query($db, "DROP TABLE IF EXISTS {$table_name}");
28?>
29--EXPECT--
30array(3) {
31  ["num"]=>
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  ["str"]=>
49  array(7) {
50    ["num"]=>
51    int(2)
52    ["type"]=>
53    string(4) "text"
54    ["len"]=>
55    int(-1)
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  ["bin"]=>
66  array(7) {
67    ["num"]=>
68    int(3)
69    ["type"]=>
70    string(5) "bytea"
71    ["len"]=>
72    int(-1)
73    ["not null"]=>
74    bool(false)
75    ["has default"]=>
76    bool(false)
77    ["array dims"]=>
78    int(0)
79    ["is enum"]=>
80    bool(false)
81  }
82}
83