include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
+$c->exec("DROP TABLE IF EXISTS test");
+new pq\Event($c, pq\Event::NOTICE, function($c, $notice) {
+ echo "Got notice: $notice\n";
+});
$t = new pq\Transaction($c);
+$c->exec("DROP TABLE IF EXISTS test");
$c->exec("CREATE TABLE test (id serial, data text)");
-$s = $c->prepare("test_insert", "INSERT INTO test (data) VALUES (\$1)", array($c->types->byName->text->oid));
+$s = $c->prepare("test_insert", "INSERT INTO test (data) VALUES (\$1)", array((new pq\Types($c))["text"]->oid));
$s->exec(array("a"));
$s->exec(array("b"));
$s->exec(array("c"));
DONE
--EXPECT--
Test
+Got notice: NOTICE: table "test" does not exist, skipping
+Got notice: NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for serial column "test.id"
1 => a
2 => b
3 => c