4 <?php include "_skipif.inc"; ?>
11 $c = new pq\Connection(PQ_DSN);
12 new pq\Event($c, pq\Event::NOTICE, function($c, $notice) {
13 echo "Got notice: $notice";
15 $t = new pq\Transaction($c);
16 $c->exec("DROP TABLE IF EXISTS test; CREATE TABLE test (id serial, data text)");
17 $s = $c->prepare("test_insert", "INSERT INTO test (data) VALUES (\$1)", array($c->types->byName->text->oid));
21 $r = $c->exec("SELECT * FROM test");
22 while ($row = $r->fetchRow(pq\Result::FETCH_OBJECT)) {
23 printf("%d => %s\n", $row->id, $row->data);
30 Got notice: NOTICE: table "test" does not exist, skipping
31 Got notice: NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for serial column "test.id"