fix package.xml
[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 ");
30 var_dump($r->fetchRow(pq\Result::FETCH_ASSOC));
31 ?>
32 DONE
33 --EXPECTF--
34 Test
35 array(12) {
36 ["null"]=>
37 NULL
38 ["bool"]=>
39 bool(true)
40 ["int2"]=>
41 int(1)
42 ["int4"]=>
43 int(2)
44 ["int8"]=>
45 int(3)
46 ["float4"]=>
47 float(1.1)
48 ["float8"]=>
49 float(2.2)
50 ["date"]=>
51 object(pq\DateTime)#%d (4) {
52 ["format"]=>
53 string(5) "Y-m-d"
54 ["date"]=>
55 string(%d) "2013-01-01 00:00:00%r(\.000000)?%r"
56 ["timezone_type"]=>
57 int(3)
58 ["timezone"]=>
59 string(3) "UTC"
60 }
61 ["abstime"]=>
62 object(pq\DateTime)#%d (4) {
63 ["format"]=>
64 string(11) "Y-m-d H:i:s"
65 ["date"]=>
66 string(%d) "1970-01-01 00:00:01%r(\.000000)?%r"
67 ["timezone_type"]=>
68 int(1)
69 ["timezone"]=>
70 string(6) "+00:00"
71 }
72 ["timestamp"]=>
73 object(pq\DateTime)#%d (4) {
74 ["format"]=>
75 string(13) "Y-m-d H:i:s.u"
76 ["date"]=>
77 string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
78 ["timezone_type"]=>
79 int(3)
80 ["timezone"]=>
81 string(3) "UTC"
82 }
83 ["timestamptz"]=>
84 object(pq\DateTime)#%d (4) {
85 ["format"]=>
86 string(14) "Y-m-d H:i:s.uO"
87 ["date"]=>
88 string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
89 ["timezone_type"]=>
90 int(1)
91 ["timezone"]=>
92 string(6) "+00:00"
93 }
94 ["intarray"]=>
95 array(3) {
96 [0]=>
97 array(3) {
98 [0]=>
99 int(1)
100 [1]=>
101 int(2)
102 [2]=>
103 int(3)
104 }
105 [1]=>
106 array(3) {
107 [0]=>
108 int(4)
109 [1]=>
110 int(5)
111 [2]=>
112 int(6)
113 }
114 [2]=>
115 array(3) {
116 [0]=>
117 NULL
118 [1]=>
119 NULL
120 [2]=>
121 NULL
122 }
123 }
124 }
125 DONE