On Thu, Jan 25, 2001 at 05:10:54PM -0300, Martin A. Marques wrote:
[ . . . ]
> OK, lets see if we can understand what each other is saying (maybe I'm not
> getting your point here).
> Lets say browser A connects to the apache server, to a page using php code.
> Lets say the code is OK (no bugs). Apache opens a persistent connection to
> the database and starts executing the queries. Now the connection between the
> apache server and the web browser doesn't close until the queries are all
> finished and the output is send back to the browser.
> Now, how about if browser B connects to the apache server just in the middle
> of the execution of the queries that browser A asked for?
> Well, the connection between Browser A and the web server is still opened, so
> another httpd child process answers the request.
I thought one of the points being raised (can't find the mail/thread I'm
referring to now) was that somehow confusion might ensue from a mix-up,
on the Apache/PHP level, regarding the client identity, thus corrupting a
transaction in progress. It seemed to make sense but now that we've
discussed it, I can't see anymore how it might happen.
. . . [ goes away to search mail archives ] . . .
Ah, here we go. A post from Rod Taylor on pgsql-hackers on Dec 27:
------------------ begin quote ------------------
The *real* problem with persistent connections is:
Script1: BEGIN;
Script1: UPDATE table set row = 'things';
Script2: Insert into table (id) values ('bad data');
Script1: COMMIT;
Since script2 managed to do a BAD insert in the middle of script1's
transaction, the transaction in script1 fails. Obvious solution? Don't
do
connection sharing when a transaction is enabled. The whole persistent
connection thing is only valid for mysql as it's the only thing that
doesn't
really support transactions (and even thats partially changed).
They need to look for stuff going through (keywords like BEGIN) and
'lock'
that connection to the single entity that opened it.
It's much easier to write your own. I wrote a few functions like:
get_connection('DB PARMS');
begin_transaction();
commit_transaction();
close_connection();
------------------ end quote ------------------
[ . . . ]
> My question would be, and seeing Adams thoughts, wouldn't it be the best
> optimization configuration of php.ini to have only one persistent conection?
> Wouldn't there be one per-child? Any way, you can't have two connections to
> the same httpd child.
Those where my thoughts too (or, rather, Adams thoughts ;)), and this is
what I am trying at the moment.
Regards, Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]