Vergleich inc/db_mysql.php - 1.8.24 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 72Zeile 72
	 * @var resource
*/
public $current_link;

	 * @var resource
*/
public $current_link;

 

/**
* @var array
*/
public $connections = array();


/**
* The database name.


/**
* The database name.

Zeile 175Zeile 180
			else
{
$connections = $config;

			else
{
$connections = $config;

			}
}

$this->db_encoding = $config['encoding'];




			}
}

if(isset($config['encoding']))
{
$this->db_encoding = $config['encoding'];
}


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)
{
if(!isset($connections[$type]) || !is_array($connections[$type]))


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)
{
if(!isset($connections[$type]) || !is_array($connections[$type]))

			{

			{

				break;
}


				break;
}


Zeile 197Zeile 205

// Shuffle the connections
shuffle($connections[$type]);


// Shuffle the connections
shuffle($connections[$type]);





			// Loop-de-loop
foreach($connections[$type] as $single_connection)
{
$connect_function = "mysql_connect";
if(isset($single_connection['pconnect']))

			// Loop-de-loop
foreach($connections[$type] as $single_connection)
{
$connect_function = "mysql_connect";
if(isset($single_connection['pconnect']))

				{

				{

					$connect_function = "mysql_pconnect";
}


					$connect_function = "mysql_pconnect";
}


Zeile 225Zeile 233
				else
{
$this->connections[] = "<span style=\"color: red\">[FAILED] [".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']}</span>";

				else
{
$this->connections[] = "<span style=\"color: red\">[FAILED] [".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']}</span>";

				}
}
}


				}
}
}


		// No write server was specified (simple connection or just multiple servers) - mirror write link
if(!array_key_exists('write', $connections))
{

		// No write server was specified (simple connection or just multiple servers) - mirror write link
if(!array_key_exists('write', $connections))
{

Zeile 252Zeile 260
		if(!$this->select_db($config['database']))
{
return -1;

		if(!$this->select_db($config['database']))
{
return -1;

		}

$this->current_link = &$this->read_link;

		}

$this->current_link = &$this->read_link;

		return $this->read_link;
}


		return $this->read_link;
}


Zeile 279Zeile 287
		else
{
$success = $read_success;

		else
{
$success = $read_success;

		}

		}


if($success && $this->db_encoding)
{


if($success && $this->db_encoding)
{

Zeile 290Zeile 298
			else
{
$this->query("SET NAMES '{$this->db_encoding}'");

			else
{
$this->query("SET NAMES '{$this->db_encoding}'");

			}


			}


			if($write_success && count($this->connections) > 1)
{
if(version_compare(PHP_VERSION, '5.2.3', '>=')) {

			if($write_success && count($this->connections) > 1)
{
if(version_compare(PHP_VERSION, '5.2.3', '>=')) {

Zeile 317Zeile 325
	function query($string, $hide_errors=0, $write_query=0)
{
global $mybb;

	function query($string, $hide_errors=0, $write_query=0)
{
global $mybb;





		get_execution_time();

// Only execute write queries on master database

		get_execution_time();

// Only execute write queries on master database

Zeile 330Zeile 338
		{
$this->current_link = &$this->read_link;
$query = @mysql_query($string, $this->read_link);

		{
$this->current_link = &$this->read_link;
$query = @mysql_query($string, $this->read_link);

		}


		}


		if($this->error_number() && !$hide_errors)
{
$this->error($string);

		if($this->error_number() && !$hide_errors)
{
$this->error($string);

Zeile 433Zeile 441
			$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".
"<td style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Write Query</strong></div></td>\n".

			$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".
"<td style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Write Query</strong></div></td>\n".

				"</tr>\n".

				"</tr>\n".

				"<tr style=\"background-color: #fefefe;\">\n".
"<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".
"</tr>\n".

				"<tr style=\"background-color: #fefefe;\">\n".
"<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".
"</tr>\n".

Zeile 446Zeile 454

$this->querylist[$this->query_count]['query'] = $string;
$this->querylist[$this->query_count]['time'] = $qtime;


$this->querylist[$this->query_count]['query'] = $string;
$this->querylist[$this->query_count]['time'] = $qtime;

	}

	}


/**
* Return a result array for a query.


/**
* Return a result array for a query.

Zeile 485Zeile 493
		if($row === false)
{
$array = $this->fetch_array($query);

		if($row === false)
{
$array = $this->fetch_array($query);

			return $array[$field];





			if($array !== null)
{
return $array[$field];
}
return null;

		}
else
{

		}
else
{

Zeile 1412Zeile 1424
			$default = '';
}


			$default = '';
}


		return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY `{$column}` {$new_definition} {$not_null}");

		return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY `{$column}` {$new_definition} {$not_null} {$default}");

	}

/**

	}

/**