Re: PostgreSQL and transactions.
| From: | Carlos Augusto Abarca | Date: | Mon, 08 Oct 2001 11:57:07 +0000 |
| Subject: | Re: PostgreSQL and transactions. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-13105@lists.php.net to get a copy of this message | ||
This usually happens when you try to connect to a PostgreSQl DB using two
identical calls. In most of the cases $connection2 is not taken into account
or is returnes with a PHP connection error. I really don´t know any way to
go around this problem. I´m sorry I couldn´t of much help.
"Morten Bruun" <morten.bruun@munkey.co.uk> escribió en el mensaje
news:Pine.LNX.4.33.0110081204530.3653-100000@saturn.munkey.co.uk...
> 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
>