Vergleich inc/db_mysql.php - 1.8.6 - 1.8.8

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

	 * @var resource
*/
public $current_link;

 

/**
* The database name.
*
* @var string
*/
public $database;


/**
* Explanation of a query.


/**
* Explanation of a query.

Zeile 82Zeile 89

/**
* The current version of MySQL.


/**
* The current version of MySQL.

	 *
* @var string

	 *
* @var string

	 */
public $version;


	 */
public $version;


Zeile 100Zeile 107
	 * @var string
*/
public $table_prefix;

	 * @var string
*/
public $table_prefix;


/**


/**

	 * The extension used to run the SQL database
*
* @var string

	 * The extension used to run the SQL database
*
* @var string

Zeile 110Zeile 117

/**
* Weather or not this engine can use the search functionality


/**
* Weather or not this engine can use the search functionality

	 *

	 *

	 * @var boolean
*/
public $can_search = true;

	 * @var boolean
*/
public $can_search = true;

Zeile 128Zeile 135
	 * @var float
*/
public $query_time = 0;

	 * @var float
*/
public $query_time = 0;


/**


/**

	 * Stores previous run query type: 1 => write; 0 => read
*
* @var int

	 * Stores previous run query type: 1 => write; 0 => read
*
* @var int

Zeile 147Zeile 154
	{
// Simple connection to one server
if(array_key_exists('hostname', $config))

	{
// Simple connection to one server
if(array_key_exists('hostname', $config))

		{

		{

			$connections['read'][] = $config;
}
// Connecting to more than one server

			$connections['read'][] = $config;
}
// Connecting to more than one server

Zeile 155Zeile 162
		{
// Specified multiple servers, but no specific read/write servers
if(!array_key_exists('read', $config))

		{
// Specified multiple servers, but no specific read/write servers
if(!array_key_exists('read', $config))

			{

			{

				foreach($config as $key => $settings)
{
if(is_int($key))

				foreach($config as $key => $settings)
{
if(is_int($key))

Zeile 182Zeile 189
			}

if(array_key_exists('hostname', $connections[$type]))

			}

if(array_key_exists('hostname', $connections[$type]))

			{

			{

				$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

				$details = $connections[$type];
unset($connections);
$connections[$type][] = $details;

Zeile 218Zeile 225
				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 230Zeile 237

// Have no read connection?
if(!$this->read_link)


// Have no read connection?
if(!$this->read_link)

		{

		{

			$this->error("[READ] Unable to connect to MySQL server");

			$this->error("[READ] Unable to connect to MySQL server");

			return false;

			return false;

		}
// No write?
else if(!$this->write_link)
{
$this->error("[WRITE] Unable to connect to MySQL server");
return false;

		}
// No write?
else if(!$this->write_link)
{
$this->error("[WRITE] Unable to connect to MySQL server");
return false;

		}

		}


// Select databases
if(!$this->select_db($config['database']))


// Select databases
if(!$this->select_db($config['database']))

Zeile 259Zeile 266
	 */
function select_db($database)
{

	 */
function select_db($database)
{

 
		$this->database = $database;


		$this->current_link = &$this->read_link;
$read_success = @mysql_select_db($database, $this->read_link) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)

		$this->current_link = &$this->read_link;
$read_success = @mysql_select_db($database, $this->read_link) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)

Zeile 266Zeile 275
			$this->current_link = &$this->write_link;
$write_success = @mysql_select_db($database, $this->write_link) or $this->error("[WRITE] Unable to select database", $this->write_link);
$success = ($read_success && $write_success ? true : false);

			$this->current_link = &$this->write_link;
$write_success = @mysql_select_db($database, $this->write_link) or $this->error("[WRITE] Unable to select database", $this->write_link);
$success = ($read_success && $write_success ? true : false);

		}

		}

		else
{
$success = $read_success;

		else
{
$success = $read_success;

Zeile 291Zeile 300
				else
{
$this->write_query("SET NAMES '{$this->db_encoding}'");

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

				}
}
}

				}
}
}

		return $success;
}


		return $success;
}


Zeile 437Zeile 446

$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.
*
* @param resource $query The query ID.

	 * Return a result array for a query.
*
* @param resource $query The query ID.

Zeile 636Zeile 645
	{
if($prefix)
{

	{
if($prefix)
{

			$query = $this->query("
SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
AND `TABLE_NAME` LIKE '".$this->escape_string($prefix)."%'
");
}
else
{
$query = $this->query("
SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
WHERE `TABLE_SCHEMA` = '$database' AND `TABLE_TYPE` = 'BASE TABLE'
");








			if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE' AND `Tables_in_$database` LIKE '".$this->escape_string($prefix)."%'");
}
else
{
$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
}
}
else
{
if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `$database` WHERE table_type = 'BASE TABLE'");
}
else
{
$query = $this->query("SHOW TABLES FROM `$database`");
}

		}

$tables = array();

		}

$tables = array();

Zeile 668Zeile 684
	function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result

	function table_exists($table)
{
// Execute on master server to ensure if we've just created a table that we get the correct result

		$query = $this->write_query("
SELECT `TABLE_NAME` FROM INFORMATION_SCHEMA.TABLES
WHERE `TABLE_TYPE` = 'BASE TABLE'
AND `TABLE_NAME` LIKE '{$this->table_prefix}$table'
");





		if(version_compare($this->get_version(), '5.0.2', '>='))
{
$query = $this->query("SHOW FULL TABLES FROM `".$this->database."` WHERE table_type = 'BASE TABLE' AND `Tables_in_".$this->database."` = '{$this->table_prefix}$table'");
}
else
{
$query = $this->query("SHOW TABLES LIKE '{$this->table_prefix}$table'");
}


		$exists = $this->num_rows($query);
if($exists > 0)
{

		$exists = $this->num_rows($query);
if($exists > 0)
{