Vergleich inc/db_mysql.php - 1.6.3 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: db_mysql.php 5380 2011-02-21 12:04:43Z Tomm $

 * $Id$

 */

class DB_MySQL

 */

class DB_MySQL

Zeile 185Zeile 185
			foreach($connections[$type] as $single_connection)
{
$connect_function = "mysql_connect";

			foreach($connections[$type] as $single_connection)
{
$connect_function = "mysql_connect";

				if($single_connection['pconnect'])

				if(isset($single_connection['pconnect']))

				{
$connect_function = "mysql_pconnect";
}

				{
$connect_function = "mysql_pconnect";
}

				
$link = $type."_link";


$link = "{$type}_link";


$this->get_execution_time();


$this->get_execution_time();





				$this->$link = @$connect_function($single_connection['hostname'], $single_connection['username'], $single_connection['password'], 1);

				$this->$link = @$connect_function($single_connection['hostname'], $single_connection['username'], $single_connection['password'], 1);





				$time_spent = $this->get_execution_time();
$this->query_time += $time_spent;


				$time_spent = $this->get_execution_time();
$this->query_time += $time_spent;


Zeile 204Zeile 204
				{
$this->connections[] = "[".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']} (Connected in ".number_format($time_spent, 0)."s)";
break;

				{
$this->connections[] = "[".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']} (Connected in ".number_format($time_spent, 0)."s)";
break;

				}

				}

				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 265Zeile 265
		}

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

		}

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

		{

		{

			$this->query("SET NAMES '{$this->db_encoding}'");
if($write_success && count($this->connections) > 1)
{

			$this->query("SET NAMES '{$this->db_encoding}'");
if($write_success && count($this->connections) > 1)
{

Zeile 284Zeile 284
	 * @return resource The query data.
*/
function query($string, $hide_errors=0, $write_query=0)

	 * @return resource The query data.
*/
function query($string, $hide_errors=0, $write_query=0)

	{

	{

		global $pagestarttime, $db, $mybb;

$this->get_execution_time();

// Only execute write queries on slave database
if($write_query && $this->write_link)

		global $pagestarttime, $db, $mybb;

$this->get_execution_time();

// Only execute write queries on slave database
if($write_query && $this->write_link)

		{

		{

			$this->current_link = &$this->write_link;
$query = @mysql_query($string, $this->write_link);
}

			$this->current_link = &$this->write_link;
$query = @mysql_query($string, $this->write_link);
}

Zeile 302Zeile 302
		}

if($this->error_number() && !$hide_errors)

		}

if($this->error_number() && !$hide_errors)

		{

		{

			 $this->error($string);
exit;

			 $this->error($string);
exit;

		}

		}


$query_time = $this->get_execution_time();
$this->query_time += $query_time;
$this->query_count++;


$query_time = $this->get_execution_time();
$this->query_time += $query_time;
$this->query_count++;

		

		

		if($mybb->debug_mode)
{
$this->explain_query($string, $query_time);

		if($mybb->debug_mode)
{
$this->explain_query($string, $query_time);

Zeile 321Zeile 321

/**
* Execute a write query on the slave database


/**
* Execute a write query on the slave database

	 *

	 *

	 * @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @return resource The query data.

	 * @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @return resource The query data.

Zeile 330Zeile 330
	{
return $this->query($query, $hide_errors, 1);
}

	{
return $this->query($query, $hide_errors, 1);
}





	/**
* Explain a query on the database.
*

	/**
* Explain a query on the database.
*

Zeile 340Zeile 340
	function explain_query($string, $qtime)
{
global $plugins;

	function explain_query($string, $qtime)
{
global $plugins;

 

$debug_extra = '';

		if($plugins->current_hook)
{
$debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";

		if($plugins->current_hook)
{
$debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";

Zeile 352Zeile 354
				"<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
"</tr>\n".
"<tr>\n".

				"<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
"</tr>\n".
"<tr>\n".

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

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

				"</tr>\n".
"<tr style=\"background-color: #efefef;\">\n".
"<td><strong>table</strong></td>\n".

				"</tr>\n".
"<tr style=\"background-color: #efefef;\">\n".
"<td><strong>table</strong></td>\n".