update doc links
[m6w6/ext-pq] / tests / types002.phpt
1 --TEST--
2 extended type support
3 --SKIPIF--
4 <?php
5 include "_skipif.inc";
6 ?>
7 --INI--
8 date.timezone=UTC
9 --FILE--
10 <?php
11 echo "Test\n";
12
13 include "_setup.inc";
14
15 $c = new pq\Connection(PQ_DSN);
16 $r = $c->exec("SET timezone TO UTC; SELECT
17 NULL as null,
18 true as bool,
19 1::int2 as int2,
20 2::int4 as int4,
21 3::int8 as int8,
22 1.1::float4 as float4,
23 2.2::float8 as float8,
24 '2013-01-01'::date as date,
25 1::abstime as abstime,
26 '2013-01-01 01:01:01'::timestamp as timestamp,
27 '2013-01-01 01:01:01 UTC'::timestamptz as timestamptz,
28 array[array[1,2,3],array[4,5,6],array[NULL::int,NULL::int,NULL::int]] as intarray,
29 array[box(point(1,2),point(2,3)),box(point(4,5),point(5,6))] as boxarray
30 ");
31 var_dump($r->fetchRow(pq\Result::FETCH_ASSOC));
32 ?>
33 DONE
34 --EXPECTF--
35 Test
36 array(13) {
37 ["null"]=>
38 NULL
39 ["bool"]=>
40 bool(true)
41 ["int2"]=>
42 int(1)
43 ["int4"]=>
44 int(2)
45 ["int8"]=>
46 int(3)
47 ["float4"]=>
48 float(1.1)
49 ["float8"]=>
50 float(2.2)
51 ["date"]=>
52 object(pq\DateTime)#%d (4) {
53 ["format"]=>
54 string(5) "Y-m-d"
55 ["date"]=>
56 string(%d) "2013-01-01 00:00:00%r(\.000000)?%r"
57 ["timezone_type"]=>
58 int(3)
59 ["timezone"]=>
60 string(3) "UTC"
61 }
62 ["abstime"]=>
63 object(pq\DateTime)#%d (4) {
64 ["format"]=>
65 string(11) "Y-m-d H:i:s"
66 ["date"]=>
67 string(%d) "1970-01-01 00:00:01%r(\.000000)?%r"
68 ["timezone_type"]=>
69 int(1)
70 ["timezone"]=>
71 string(6) "+00:00"
72 }
73 ["timestamp"]=>
74 object(pq\DateTime)#%d (4) {
75 ["format"]=>
76 string(13) "Y-m-d H:i:s.u"
77 ["date"]=>
78 string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
79 ["timezone_type"]=>
80 int(3)
81 ["timezone"]=>
82 string(3) "UTC"
83 }
84 ["timestamptz"]=>
85 object(pq\DateTime)#%d (4) {
86 ["format"]=>
87 string(14) "Y-m-d H:i:s.uO"
88 ["date"]=>
89 string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
90 ["timezone_type"]=>
91 int(1)
92 ["timezone"]=>
93 string(6) "+00:00"
94 }
95 ["intarray"]=>
96 array(3) {
97 [0]=>
98 array(3) {
99 [0]=>
100 int(1)
101 [1]=>
102 int(2)
103 [2]=>
104 int(3)
105 }
106 [1]=>
107 array(3) {
108 [0]=>
109 int(4)
110 [1]=>
111 int(5)
112 [2]=>
113 int(6)
114 }
115 [2]=>
116 array(3) {
117 [0]=>
118 NULL
119 [1]=>
120 NULL
121 [2]=>
122 NULL
123 }
124 }
125 ["boxarray"]=>
126 array(2) {
127 [0]=>
128 string(11) "(2,3),(1,2)"
129 [1]=>
130 string(11) "(5,6),(4,5)"
131 }
132 }
133 DONE