-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
The attached patch checks to see if persistant MySQL links are enabled, and if
so, opens (or re-uses) one. If mysql_pconnect() fails or if persistant links
are not enabled, mysql_connect() is used as before.
Thoughts?
Elfyn
- --
Elfyn McBratney, EMCB
mailto:[EMAIL PROTECTED]
http://www.emcb.co.uk/
PGP Key ID: 0x456548B4
PGP Key Fingerprint:
29D5 91BB 8748 7CC9 650F 31FE 6888 0C2A 4565 48B4
Error: quote_machine(): Dry humour detected.
>> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <<
<< ~ Linux london 2.6.5-emcb-243 #2 i686 GNU/Linux ~ >>
>> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ <<
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAhLx3aIgMKkVlSLQRAnmwAJwIhi22xysafdZZkGY3lh0+4S0CBgCgppqt
gzrt/oTq4qYdX67r7YaI8kA=
=FHDm
-----END PGP SIGNATURE-----
--- HEAD/frontend/php/include/database.php 2004-03-13 18:22:06.000000000 +0000
+++ HEAD_mysql_persistant_links/frontend/php/include/database.php 2004-04-20 05:51:43.941072545 +0000
@@ -22,8 +22,19 @@
function db_connect()
{
global $sys_dbhost,$sys_dbuser,$sys_dbpasswd,$conn;
- $conn = mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
-#return $conn;
+
+ // If persistant MySQL links are enabled, try and open a
+ // persistant link.
+ $mysql_persistant_links = ini_get('mysql.allow_persistent');
+ if (strtolower($mysql_persistant_links) == 'on' || $mysql_persistant_links == '1' ) {
+ $conn = mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
+ }
+
+ // If $conn is not a valid resource, try and open a normal
+ // (non persistant) link.
+ if (!is_resource($conn)) {
+ $conn = mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
+ }
}
function db_query($qstring,$print=0)