Vergleich inc/db_mysqli.php - 1.8.6 - 1.8.7

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

	 * @var mysqli
*/
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 119Zeile 126
	 * The database encoding currently in use (if supported)
*
* @var string

	 * The database encoding currently in use (if supported)
*
* @var string

	 */

	 */

	public $db_encoding = "utf8";

/**

	public $db_encoding = "utf8";

/**

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

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





	/**
* Stores previous run query type: 1 => write; 0 => read
*

	/**
* Stores previous run query type: 1 => write; 0 => read
*

Zeile 146Zeile 153
	{
// 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;
}
else

			$connections['read'][] = $config;
}
else

Zeile 154Zeile 161
		{
// 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 181Zeile 188
			}

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 198Zeile 205
				if(!empty($single_connection['pconnect']) && version_compare(PHP_VERSION, '5.3.0', '>='))
{
$persist = 'p:';

				if(!empty($single_connection['pconnect']) && version_compare(PHP_VERSION, '5.3.0', '>='))
{
$persist = 'p:';

				}


				}


				$link = "{$type}_link";

get_execution_time();

				$link = "{$type}_link";

get_execution_time();

Zeile 218Zeile 225
				else
{
$this->$link = @$connect_function($persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password']);

				else
{
$this->$link = @$connect_function($persist.$single_connection['hostname'], $single_connection['username'], $single_connection['password']);

				}


				}


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


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


Zeile 238Zeile 245

// 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))

		{

		{

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

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

		}

		}


// Have no read connection?
if(!$this->read_link)
{
$this->error("[READ] Unable to connect to MySQL server");


// Have no read connection?
if(!$this->read_link)
{
$this->error("[READ] Unable to connect to MySQL server");

			return false;
}

			return false;
}

		// No write?
else if(!$this->write_link)
{

		// No write?
else if(!$this->write_link)
{

Zeile 273Zeile 280
	 */
function select_db($database)
{

	 */
function select_db($database)
{

 
		$this->database = $database;


		$master_success = @mysqli_select_db($this->read_link, $database) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)
{

		$master_success = @mysqli_select_db($this->read_link, $database) or $this->error("[READ] Unable to select database", $this->read_link);
if($this->write_link)
{

Zeile 292Zeile 301
			if($slave_success && count($this->connections) > 1)
{
@mysqli_set_charset($this->write_link, $this->db_encoding);

			if($slave_success && count($this->connections) > 1)
{
@mysqli_set_charset($this->write_link, $this->db_encoding);

			}

			}

		}
return $success;
}

		}
return $success;
}

Zeile 436Zeile 445

$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 632Zeile 641
	{
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 651Zeile 667
		{
$tables[] = $table;
}

		{
$tables[] = $table;
}

 


		return $tables;
}


		return $tables;
}


Zeile 663Zeile 680
	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'
");
$exists = $this->num_rows($query);



		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)
{
return true;

		if($exists > 0)
{
return true;