1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-11 08:59:45 +01:00
ext-pq/tests/types002.phpt

133 lines
2.3 KiB
Plaintext
Raw Normal View History

2013-04-29 14:24:05 +02:00
--TEST--
extended type support
--SKIPIF--
<?php
include "_skipif.inc";
?>
2013-05-01 13:57:41 +02:00
--INI--
date.timezone=UTC
2013-04-29 14:24:05 +02:00
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
$r = $c->exec("SET timezone TO UTC; SELECT
NULL as null,
true as bool,
1::int2 as int2,
2::int4 as int4,
3::int8 as int8,
1.1::float4 as float4,
2.2::float8 as float8,
'2013-01-01'::date as date,
1::abstime as abstime,
'2013-01-01 01:01:01'::timestamp as timestamp,
'2013-01-01 01:01:01 UTC'::timestamptz as timestamptz,
array[array[1,2,3],array[4,5,6],array[NULL::int,NULL::int,NULL::int]] as intarray,
array[box(point(1,2),point(2,3)),box(point(4,5),point(5,6))] as boxarray
2013-04-29 14:24:05 +02:00
");
var_dump($r->fetchRow(pq\Result::FETCH_ASSOC));
?>
DONE
--EXPECTF--
Test
array(13) {
2013-04-29 14:24:05 +02:00
["null"]=>
NULL
["bool"]=>
bool(true)
["int2"]=>
int(1)
["int4"]=>
int(2)
["int8"]=>
int(3)
["float4"]=>
float(1.1)
["float8"]=>
float(2.2)
["date"]=>
object(pq\DateTime)#%d (4) {
["format"]=>
string(5) "Y-m-d"
["date"]=>
string(%d) "2013-01-01 00:00:00%r(\.000000)?%r"
2013-04-29 14:24:05 +02:00
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
["abstime"]=>
object(pq\DateTime)#%d (4) {
["format"]=>
string(11) "Y-m-d H:i:s"
["date"]=>
string(%d) "1970-01-01 00:00:01%r(\.000000)?%r"
2013-04-29 14:24:05 +02:00
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+00:00"
}
["timestamp"]=>
object(pq\DateTime)#%d (4) {
["format"]=>
string(13) "Y-m-d H:i:s.u"
["date"]=>
string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
2013-04-29 14:24:05 +02:00
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
["timestamptz"]=>
object(pq\DateTime)#%d (4) {
["format"]=>
string(14) "Y-m-d H:i:s.uO"
["date"]=>
string(%d) "2013-01-01 01:01:01%r(\.000000)?%r"
2013-04-29 14:24:05 +02:00
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+00:00"
}
["intarray"]=>
array(3) {
[0]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
[1]=>
array(3) {
[0]=>
int(4)
[1]=>
int(5)
[2]=>
int(6)
}
[2]=>
array(3) {
[0]=>
NULL
[1]=>
NULL
[2]=>
NULL
}
}
["boxarray"]=>
array(2) {
[0]=>
string(11) "(2,3),(1,2)"
[1]=>
string(11) "(5,6),(4,5)"
}
2013-04-29 14:24:05 +02:00
}
DONE