How about combining MySQLi with mysql_pconnect? Assuming both are
persistent, would those connections be shared?
The goal here is to use prepared statements. I read that MySQLi only
supports persistent connections in php version 5.3 which we are not yet
running, but perhaps it would be worth waiting for 5.3.
Christopher Jones wrote:
Andy Shellam (Mailing Lists) wrote:
> "First, when connecting, the function would first try to find a
> (persistent) link that's already open with the same host, username
> and password. If one is found, an identifier for it will be returned
> instead of opening a new connection."
> Therefore, providing you've configured PHP's --with-mysql and
> --with-pdo-mysql options with the same MySQL library, then as long
> as the host, username and password are the same, the same connection
> will be re-used for both the native (mysql_pconnect) connection and
> the PDO connection.
The doc refers to the PHP end of the connection and only to any
existing PDO connection. PDO uses a hash table for open connections
which it scans for matches when a PDO connection call is executed.
The hash key is unique and begins with "PDO:DBH:DSN=". The mysql
extension uses "mysql_" for its hash key prefix. This mean the PHP
data structures for persistent connections won't be shared between the
Whether the MySQL client library or the MySQL database reuses any
connection data underneath, I don't know. In Oracle the answer would
be that PDO_OCI and OCI8 connections are distinct and transactionally
separate (though they could share the same database connection pool if
one was enabled).
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php