From: | "WeiShang" <thanks(at)verymuch(dot)com> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | commit and rollback |
Date: | 2005-09-10 07:48:38 |
Message-ID: | dfu32l$9eb$3@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
--
From | Date | Subject | |
---|---|---|---|
Next Message | JUAN ERNESTO FLORES BELTRAN | 2005-09-12 13:02:47 | Connection Error |
Previous Message | Andrei Verovski (aka MacGuru) | 2005-09-08 20:28:40 | Getting list of Indexes & contrains |