[Mapbender-commits] r5271 - branches/2.6/lib trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 5 10:11:15 EST 2010


Author: christoph
Date: 2010-01-05 10:11:14 -0500 (Tue, 05 Jan 2010)
New Revision: 5271

Modified:
   branches/2.6/lib/database-mysql.php
   trunk/mapbender/lib/database-mysql.php
Log:
http://trac.osgeo.org/mapbender/ticket/560

Modified: branches/2.6/lib/database-mysql.php
===================================================================
--- branches/2.6/lib/database-mysql.php	2010-01-05 13:48:25 UTC (rev 5270)
+++ branches/2.6/lib/database-mysql.php	2010-01-05 15:11:14 UTC (rev 5271)
@@ -86,12 +86,23 @@
 		//  if configured for replication, $conn is the read-only host
 		//  we do not connect to update server until needed
 		//
-		$conn = @mysql_pconnect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
-		$conn_update=@mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
-	} else {
-		$conn = @mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd);
-		#echo "@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd)";
+		$conn = mysql_connect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
+		$conn_update= mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
+	} 
+	else {
+		# Create a new connection...
+		if( version_compare( PHP_VERSION, '4.2.0', 'ge' ) ) {
+			$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd, true );
+		} 
+		else {
+			# On PHP 4.1 the new_link parameter is not available. We cannot
+			# guarantee that we'll actually get a new connection, and this
+			# may cause some operations to fail possibly.
+			$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd );
+		}
+	
 	}
+
 	if ($sys_dbname)
 		@mysql_select_db($sys_dbname);
 	return $conn;

Modified: trunk/mapbender/lib/database-mysql.php
===================================================================
--- trunk/mapbender/lib/database-mysql.php	2010-01-05 13:48:25 UTC (rev 5270)
+++ trunk/mapbender/lib/database-mysql.php	2010-01-05 15:11:14 UTC (rev 5271)
@@ -86,12 +86,23 @@
 		//  if configured for replication, $conn is the read-only host
 		//  we do not connect to update server until needed
 		//
-		$conn = @mysql_pconnect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
-		$conn_update=@mysql_pconnect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
-	} else {
-		$conn = @mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd);
-		#echo "@mysql_pconnect($sys_dbhost.$sys_dbport,$sys_dbuser,$sys_dbpasswd)";
+		$conn = mysql_connect($sys_dbreadhost,$sys_dbuser,$sys_dbpasswd);
+		$conn_update= mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd);
+	} 
+	else {
+		# Create a new connection...
+		if( version_compare( PHP_VERSION, '4.2.0', 'ge' ) ) {
+			$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd, true );
+		} 
+		else {
+			# On PHP 4.1 the new_link parameter is not available. We cannot
+			# guarantee that we'll actually get a new connection, and this
+			# may cause some operations to fail possibly.
+			$conn = mysql_connect( $sys_dbhost,$sys_dbuser,$sys_dbpasswd );
+		}
+	
 	}
+
 	if ($sys_dbname)
 		@mysql_select_db($sys_dbname);
 	return $conn;



More information about the Mapbender_commits mailing list