Vergleich inc/db_mysqli.php - 1.4.2 - 1.4.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: db_mysqli.php 4138 2008-08-21 20:23:13Z Tikitiki $

 * $Id: db_mysqli.php 4304 2009-01-02 01:11:56Z chris $

 */

class DB_MySQLi

 */

class DB_MySQLi

Zeile 143Zeile 143
		{
$connections['read'][] = $config;
}

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

 
		else

		// Connecting to more than one server
{
// Specified multiple servers, but no specific read/write servers

		// Connecting to more than one server
{
// Specified multiple servers, but no specific read/write servers

Zeile 198Zeile 199
				if($port)
{
$this->$link = @$connect_function($hostname, $single_connection['username'], $single_connection['password'], "", $port);

				if($port)
{
$this->$link = @$connect_function($hostname, $single_connection['username'], $single_connection['password'], "", $port);

				}

				}

				else

				else

				{

				{

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


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


Zeile 212Zeile 213
				{
$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>";

Zeile 238Zeile 239
		}

// Select databases

		}

// Select databases

		$this->select_db($config['database']);




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


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


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

Zeile 255Zeile 259
		global $mybb;

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

		global $mybb;

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

		if($this->write_link)

		if($this->write_link)

		{
$slave_success = @mysqli_select_db($this->write_link, $database) or $this->error("[WRITE] Unable to slave database", $this->write_link);


		{
$slave_success = @mysqli_select_db($this->write_link, $database) or $this->error("[WRITE] Unable to slave database", $this->write_link);


Zeile 297Zeile 301
		{
$this->current_link = &$this->write_link;
$query = @mysqli_query($this->write_link, $string);

		{
$this->current_link = &$this->write_link;
$query = @mysqli_query($this->write_link, $string);

		}

		}

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

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

Zeile 366Zeile 370
				"<td><strong>rows</strong></td>\n".
"<td><strong>Extra</strong></td>\n".
"</tr>\n";

				"<td><strong>rows</strong></td>\n".
"<td><strong>Extra</strong></td>\n".
"</tr>\n";





			while($table = mysqli_fetch_assoc($query))
{
$this->explain .=

			while($table = mysqli_fetch_assoc($query))
{
$this->explain .=

Zeile 549Zeile 553
			{
trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
}

			{
trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
}

 
		}
else
{
return false;

		}
}


		}
}


Zeile 559Zeile 567
	 * @return int The number of affected rows.
*/
function affected_rows()

	 * @return int The number of affected rows.
*/
function affected_rows()

	{

	{

		return mysqli_affected_rows($this->current_link);
}


		return mysqli_affected_rows($this->current_link);
}



/**


/**

	 * Return the number of fields.
*
* @param resource The query data.
* @return int The number of fields.

	 * Return the number of fields.
*
* @param resource The query data.
* @return int The number of fields.

	 */

	 */

	function num_fields($query)
{
return mysqli_num_fields($query);

	function num_fields($query)
{
return mysqli_num_fields($query);

Zeile 588Zeile 596
		{
$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
}

		{
$query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
}

		else
{
$query = $this->query("SHOW TABLES FROM `$database`");
}

		else
{
$query = $this->query("SHOW TABLES FROM `$database`");
}

		
while(list($table) = mysqli_fetch_array($query))
{

		
while(list($table) = mysqli_fetch_array($query))
{

Zeile 602Zeile 610

/**
* Check if a table exists in a database.


/**
* Check if a table exists in a database.

	 *
* @param string The table name.

	 *
* @param string The table name.

	 * @return boolean True when exists, false if not.
*/
function table_exists($table)

	 * @return boolean True when exists, false if not.
*/
function table_exists($table)

Zeile 614Zeile 622
		$query = $this->write_query("
SHOW TABLES
LIKE '{$this->table_prefix}$table'

		$query = $this->write_query("
SHOW TABLES
LIKE '{$this->table_prefix}$table'

		");
$exists = $this->num_rows($query);
$this->error_reporting = $err;


		");
$exists = $this->num_rows($query);
$this->error_reporting = $err;


		if($exists > 0)
{
return true;

		if($exists > 0)
{
return true;

Zeile 659Zeile 667

/**
* Add a shutdown query.


/**
* Add a shutdown query.

	 *

	 *

	 * @param resource The query data.
* @param string An optional name for the query.
*/

	 * @param resource The query data.
* @param string An optional name for the query.
*/

Zeile 673Zeile 681
		else
{
$shutdown_queries[] = $query;

		else
{
$shutdown_queries[] = $query;

		}

		}

	}

/**

	}

/**

Zeile 700Zeile 708
			if(isset($options['order_dir']))
{
$query .= " ".my_strtoupper($options['order_dir']);

			if(isset($options['order_dir']))
{
$query .= " ".my_strtoupper($options['order_dir']);

			}
}

			}
}

		
if(isset($options['limit_start']) && isset($options['limit']))
{

		
if(isset($options['limit_start']) && isset($options['limit']))
{

Zeile 1036Zeile 1044
	function drop_index($table, $name)
{
$this->write_query("ALTER TABLE {$this->table_prefix}$table DROP INDEX $name");

	function drop_index($table, $name)
{
$this->write_query("ALTER TABLE {$this->table_prefix}$table DROP INDEX $name");

 
	}

/**
* Checks to see if an index exists on a specified table
*
* @param string The name of the table.
* @param string The name of the index.
*/
function index_exists($table, $index)
{
$index_exists = false;
$query = $this->write_query("SHOW INDEX FROM {$this->table_prefix}{$table}");
while($ukey = $this->fetch_array($query))
{
if($ukey['Key_name'] == $index)
{
$index_exists = true;
break;
}
}

if($index_exists)
{
return true;
}

return false;

	}

/**

	}

/**

Zeile 1131Zeile 1166
	 */
function fetch_db_charsets()
{

	 */
function fetch_db_charsets()
{

		if($this_link && $this->get_version() < 4.1)

		if($this->link && version_compare($this->get_version(), "4.1", "<"))

		{
return false;
}

		{
return false;
}