Vergleich inc/db_mysqli.php - 1.4.1 - 1.4.5

  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 4067 2008-08-04 03:59:08Z 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 406Zeile 410

$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 420Zeile 424
	{
$array = mysqli_fetch_assoc($query);
return $array;

	{
$array = mysqli_fetch_assoc($query);
return $array;

	}

/**

	}

/**

	 * Return a specific field from a query.
*
* @param resource The query ID.

	 * Return a specific field from a query.
*
* @param resource The query ID.

Zeile 448Zeile 452
	function data_seek($query, $row)
{
return mysqli_data_seek($query, $row);

	function data_seek($query, $row)
{
return mysqli_data_seek($query, $row);

	}

/**

	}

/**

	 * Return the number of rows resulting from a query.
*
* @param resource The query data.

	 * Return the number of rows resulting from a query.
*
* @param resource The query data.

Zeile 477Zeile 481
	 *
*/
function close()

	 *
*/
function close()

	{

	{

		@mysqli_close($this->read_link);
if($this->write_link)
{

		@mysqli_close($this->read_link);
if($this->write_link)
{

			@mysql_close($this->write_link);

			@mysqli_close($this->write_link);

		}
}


		}
}


Zeile 491Zeile 495
	 * @return int The error number of the current error.
*/
function error_number()

	 * @return int The error number of the current error.
*/
function error_number()

	{
if($this->current_link)

	{
if($this->current_link)

		{
return mysqli_errno($this->current_link);
}

		{
return mysqli_errno($this->current_link);
}

Zeile 506Zeile 510
	 * Return an error string.
*
* @return string The explanation for the current error.

	 * Return an error string.
*
* @return string The explanation for the current error.

	 */

	 */

	function error_string()
{
if($this->current_link)

	function error_string()
{
if($this->current_link)

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;

		}
}


		}
}






	/**
* Returns the number of affected rows in a query.
*

	/**
* Returns the number of affected rows in a query.
*

Zeile 561Zeile 569
	function affected_rows()
{
return mysqli_affected_rows($this->current_link);

	function affected_rows()
{
return mysqli_affected_rows($this->current_link);

	}


	}



/**
* Return the number of fields.


/**
* Return the number of fields.

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 846Zeile 854
	 */
function escape_string($string)
{

	 */
function escape_string($string)
{

		if(function_exists("mysql_real_escape_string") && $this->read_link)

		if(function_exists("mysqli_real_escape_string") && $this->read_link)

		{
$string = mysqli_real_escape_string($this->read_link, $string);
}

		{
$string = mysqli_real_escape_string($this->read_link, $string);
}

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;
}