commit and rollback
| От | WeiShang |
|---|---|
| Тема | commit and rollback |
| Дата | |
| Msg-id | dfu32l$9eb$3@news.hub.org обсуждение исходный текст |
| Ответы |
Re: commit and rollback
|
| Список | pgsql-php |
Hi,
I have a problem about commit and rollback using php. For the script below,
if "foo" is called and commit and if rollback statment also run. Will the
update statement under foo also rollback? or commit?
Thanks in advance!
----------------------------------------------------------------------------
-----------Script starts
function foo(var1,var2)
{
pg_query($db,"begin");
pg_query($db,"<update statement here>");
pg_query($db,"commit");
}
pg_query($db,"begin");
.....
foo(v1,v2);
$result1=pg_query($db,"<update statment here>");
if (pg_affected_rows($result)==0)
pg_query($db,"rollback");
else
pg_query($db,"commit");
----------------------------------------------------------------------------
-----------Script end
--
В списке pgsql-php по дате отправления: