PostgreSQL and transactions.
| From: | Morten Bruun | Date: | Mon, 08 Oct 2001 11:13:10 +0000 |
| Subject: | PostgreSQL and transactions. | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13103@lists.php.net to get a copy of this message | ||
Hi there!
I was thinking about using PostgreSQL because I need the transaction
management features, but I've come across a problem:
$connection1 = pg_pconnect('dbname=mydb');
$connection2 = pg_pconnect('dbname=mydb');
pg_exec($connection1, "begin");
pg_Exec($connection1, "insert into mytable values ('firstvalue')");
pg_Exec($connection2, "insert into mytable values ('secondvalue')");
pg_Exec($connection1, "rollback");
This piece of code didn't do what I expected it to do. I does not insert
'secondvalue' into the table mytable. I looked around in the manual
(http://www.php.net/manual/en/) and found out that two identical calls to
pg_connect() returns the same connection.
Is there any way of avoiding this? And does that mean that different
request to a php page gets the same connection to the database?
Thanks in advance!
/Morten