2013-01-21 12:13:04 +01:00
|
|
|
--TEST--
|
|
|
|
basic functionality
|
|
|
|
--SKIPIF--
|
|
|
|
<?php include "_skipif.inc"; ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
echo "Test\n";
|
|
|
|
|
|
|
|
include "_setup.inc";
|
|
|
|
|
|
|
|
$con = new pq\Connection(PQ_DSN);
|
|
|
|
$res = $con->exec("SELECT 1 as one, 2 as two from generate_series(1,2)");
|
|
|
|
|
|
|
|
var_dump($res->status == pq\Result::TUPLES_OK);
|
|
|
|
var_dump($res->numRows);
|
|
|
|
var_dump($res->numCols);
|
2013-02-14 14:54:22 +01:00
|
|
|
var_dump(count($res) == $res->count(), $res->numRows == count($res));
|
2013-01-21 12:13:04 +01:00
|
|
|
|
|
|
|
foreach ($res as $rowNum => $rowData) {
|
|
|
|
printf("%d.0 => %d\n", $rowNum, $rowData[0]);
|
|
|
|
printf("%d.1 => %d\n", $rowNum, $rowData[1]);
|
|
|
|
}
|
|
|
|
$res->fetchType = pq\Result::FETCH_ASSOC;
|
|
|
|
foreach ($res as $rowNum => $rowData) {
|
|
|
|
printf("%d.0 => %d\n", $rowNum, $rowData["one"]);
|
|
|
|
printf("%d.1 => %d\n", $rowNum, $rowData["two"]);
|
|
|
|
}
|
|
|
|
$res->fetchType = pq\Result::FETCH_OBJECT;
|
|
|
|
foreach ($res as $rowNum => $rowData) {
|
|
|
|
printf("%d.0 => %d\n", $rowNum, $rowData->one);
|
|
|
|
printf("%d.1 => %d\n", $rowNum, $rowData->two);
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
DONE
|
|
|
|
--EXPECT--
|
|
|
|
Test
|
|
|
|
bool(true)
|
|
|
|
int(2)
|
|
|
|
int(2)
|
2013-02-14 14:54:22 +01:00
|
|
|
bool(true)
|
|
|
|
bool(true)
|
2013-01-21 12:13:04 +01:00
|
|
|
0.0 => 1
|
|
|
|
0.1 => 2
|
|
|
|
1.0 => 1
|
|
|
|
1.1 => 2
|
|
|
|
0.0 => 1
|
|
|
|
0.1 => 2
|
|
|
|
1.0 => 1
|
|
|
|
1.1 => 2
|
|
|
|
0.0 => 1
|
|
|
|
0.1 => 2
|
|
|
|
1.0 => 1
|
|
|
|
1.1 => 2
|
|
|
|
DONE
|