I've posted this to the PHP-db list also, but I find the people on this
list usually more precise in their answers so I was hoping someone here
might be able to help me.
I'm a little confused/worried about database transactions, persistent
connections and PHP. (Of course I am using postgresQL :)
I am worried that if I use persistent connections it might be possible
for more than one PHP script to be inside the same transaction at the
1- page1.php is a script that opens a persistent connection to a DB and
starts a transaction.
2- User 1 goes to page1.php
3- User 2 goes to page1.php
1- is it possible that user 2 will be using the same connection as user
1? So if user 1's transaction fails so will user 2's?
2- If user 1's hits the stop button on his browser, what happens to his
transaction? I assume it is stopped. But what about the connection? If
user 2 gets the same connection, will his transaction fail?
3- If I don't use persistent connections, do all my worries go away?
I've abstracted the DB layer out of my code, but one side-effect is that
each SQL statement causes a new connection to be made. If a script
wanted to do the following:
INSERT into t values('1');
my code would actually create one connection per SQL statement. PHP is
supposed to re-use the same backend if a running script open a new
connection with the same parameters but I am worried that it doesn't,
and so transactions may fail.
I've never used transactions before, and even though they are a simple
concept, I'm worried that going through PHP might result in unexpected
pgsql-general by date
|Next:||From: Gurkan Sengun||Date: 2002-08-31 10:17:22|
|Subject: postgresql banner|
|Previous:||From: Garo Hussenjian||Date: 2002-08-31 06:00:18|
|Subject: Bigint in sequences|