1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-30 04:19:49 +01:00

transactions

This commit is contained in:
Michael Wallner 2013-01-25 21:08:56 +01:00
parent 53220e4b7f
commit 01a3a98f9a
4 changed files with 683 additions and 108 deletions

9
TODO
View File

@ -3,11 +3,18 @@
* LOBs
* COPY
* pq\Cancel
* transaction savepoints
* transaction snapshots
* notice receiver (else libpq uses stderr)
* pq\Event\Notice
* pq\Event\Result\Create,
pq\Event\Result\Destroy,
pq\Event\Connection\Reset,
pq\Event\Connection\Destroy
* fetchInto/fetchCtor?
* unlisten?
* tracing?
* userland event handler?
* notice receiver?
* pq\Result->__clone through PQcopyResult?
* db/pass/user/host/port/options properties on pq\Connection?

File diff suppressed because it is too large Load Diff

View File

@ -32,13 +32,6 @@ zend_module_entry pq_module_entry;
# include "TSRM.h"
#endif
PHP_MINIT_FUNCTION(pq);
PHP_MSHUTDOWN_FUNCTION(pq);
PHP_RINIT_FUNCTION(pq);
PHP_RSHUTDOWN_FUNCTION(pq);
PHP_MINFO_FUNCTION(pq);
/*
ZEND_BEGIN_MODULE_GLOBALS(pq)
long global_value;

30
tests/trans001.phpt Normal file
View File

@ -0,0 +1,30 @@
--TEST--
transaction
--SKIPIF--
<?php include "_skipif.inc"; ?>
--FILE--
<?php
echo "Test\n";
include "_setup.inc";
$c = new pq\Connection(PQ_DSN);
$t = new pq\Transaction($c);
$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->exec(array("a"));
$s->exec(array("b"));
$s->exec(array("c"));
$r = $c->exec("SELECT * FROM test");
while ($row = $r->fetchRow(pq\Result::FETCH_OBJECT)) {
printf("%d => %s\n", $row->id, $row->data);
}
$t->rollback();
?>
DONE
--EXPECT--
Test
1 => a
2 => b
3 => c
DONE