Re: [PDO] Question on Persistent PDO Connections

[email protected] (Lester Caine) Fri, 06 Nov 2009 10:46:54 +0000
Newsgroups php.pdo
Message-ID <[email protected]>
Ulf Wendel wrote:
> Lukas Kahwe Smith schrieb:
>> well for mysql traditonally persistent connections came with the risk 
>> of an unclean session. i guess there is now a solution to clean up the 
>> session fairly well, making persistent connections more feasible, 
> 
> COM_CHANGE_USER/mysql_change_user() cleans up the line. The call itself 
> exists since quite some time. In its early days (say more than three 
> years ago) it was known to have issues. But its working fine nowadays.
> 
> Its possible to clean up the line before reuse, if wanted. Calling 
> mysql_change_user is the default for ext/mysqli. However, if you know 
> what you do, you may not want to clean the line for performance reasons.

Actually Ulf that sounds a little strange when the mechanism to use an 
existing connection is that your new connection MUST have the same 
username and password. Ideally I think, there should be nothing 
'persisting' other then an open pipe, so if a particular database needs 
to be 'cleaned up', that should be automatic when finishing use of the 
connection? Any connection should not be left in an 'indeterminate' 
state anyway. On Firebird one would not want to persist a transaction 
between 'sessions' and the PDO mantra should be consistency (ACID) 
rather than security or performance.

I think that 'persisting' anything more than the connection should be 
left firmly wrapped in some driver specific functionality with a 'ring 
fence' saying "This can not be used across databases" ?

And perhaps that is what we are missing here? PDO needs TWO levels of 
functionality. Cross database compatible activity, and restricted to 
specific driver. With a clean 'ring fence' so that we know what we can 
use transparently, and what will not be possible to abstract between 
databases?

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php