Re: [PDO] Question on Persistent PDO Connections

From: Date: Thu, 05 Nov 2009 19:47:29 +0000
Subject: Re: [PDO] Question on Persistent PDO Connections
References: 1 2 3 4 5  Groups: php.pdo 
Request: Send a blank email to pdo+get-300@lists.php.net to get a copy of this message
Ulf Wendel wrote:
PDO specs: define how PDO drivers may/shall behave PDO API: implement bool PDO::resetsPersistentConnection() PDO API: options setPersistentConnectionReset() Choose whatever function name you like as long you end up having: - a clear statement in the PDO specs what whall happen - a documented and portable way to check the status of the implementation of a PDO specific feature (here: persistent - connections).
PDO has a way to detect whether a persistent call was made http://www.php.net/manual/en/pdo.getattribute.php, but there isn't going to be a PDO DB-portable way to tell whether the DB created the connection or reused it or reset etc. So my clear statement (tm) suggestion is "PHP shall not generically make any assummptions about the connection state of a new PDO connection, except that it will not have an open transaction. Some databases may have optimizations that allow global state information to be retained from a persistent connection in one script into another script. The safest practice is to assume that this state is not carried over and must be reset. Refer to the PDO_xxx driver documentation for database specific information". Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd

« previous php.pdo (#300) next »