4 <?php include "_skipif.inc"; ?>
11 $con = new pq\Connection(PQ_DSN);
12 $res = $con->exec("SELECT 1 as one, 2 as two from generate_series(1,2)");
14 var_dump($res->status == pq\Result::TUPLES_OK);
15 var_dump($res->numRows);
16 var_dump($res->numCols);
18 foreach ($res as $rowNum => $rowData) {
19 printf("%d.0 => %d\n", $rowNum, $rowData[0]);
20 printf("%d.1 => %d\n", $rowNum, $rowData[1]);
22 $res->fetchType = pq\Result::FETCH_ASSOC;
23 foreach ($res as $rowNum => $rowData) {
24 printf("%d.0 => %d\n", $rowNum, $rowData["one"]);
25 printf("%d.1 => %d\n", $rowNum, $rowData["two"]);
27 $res->fetchType = pq\Result::FETCH_OBJECT;
28 foreach ($res as $rowNum => $rowData) {
29 printf("%d.0 => %d\n", $rowNum, $rowData->one);
30 printf("%d.1 => %d\n", $rowNum, $rowData->two);