Vergleich inc/db_mysqli.php - 1.4.1 - 1.4.16

  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 5379 2011-02-21 11:06:42Z Tomm $

 */

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 184Zeile 185
			foreach($connections[$type] as $single_connection)
{
$connect_function = "mysqli_connect";

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

				if($single_connection['pconnect'])


				$persist = "";
if($single_connection['pconnect'] && version_compare(PHP_VERSION, '5.3.0', '>='))

				{

				{

					$connect_function = "mysqli_pconnect";

					$persist = "p:";

				}

$link = $type."_link";

				}

$link = $type."_link";





				$this->get_execution_time();

				$this->get_execution_time();





				// Specified a custom port for this connection?
list($hostname, $port) = explode(":", $single_connection['hostname'], 2);
if($port)

				// Specified a custom port for this connection?
list($hostname, $port) = explode(":", $single_connection['hostname'], 2);
if($port)

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


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


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


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


Zeile 238Zeile 240
		}

// 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 257Zeile 262
		$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)
{

			$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 select slave database", $this->write_link);

			
$success = ($master_success && $slave_success ? true : false);
}

			
$success = ($master_success && $slave_success ? true : false);
}

Zeile 480Zeile 485
	{
@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 495Zeile 500
		if($this->current_link)
{
return mysqli_errno($this->current_link);

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

		}

		}

		else
{
return mysqli_connect_errno();

		else
{
return mysqli_connect_errno();

Zeile 523Zeile 528
	 * Output a database error.
*
* @param string The string to present as an error.

	 * Output a database error.
*
* @param string The string to present as an error.

	 */

	 */

	function error($string="")
{
if($this->error_reporting)

	function error($string="")
{
if($this->error_reporting)

Zeile 549Zeile 554
			{
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 591Zeile 600
		else
{
$query = $this->query("SHOW TABLES FROM `$database`");

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

		}


		}


		while(list($table) = mysqli_fetch_array($query))
{
$tables[] = $table;

		while(list($table) = mysqli_fetch_array($query))
{
$tables[] = $table;

Zeile 846Zeile 855
	 */
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 925Zeile 934
	 *
* @param string The name of the table.
* @return string The MySQL command to create the specified table.

	 *
* @param string The name of the table.
* @return string The MySQL command to create the specified table.

	 */

	 */

	function show_create_table($table)
{
$query = $this->write_query("SHOW CREATE TABLE ".$this->table_prefix.$table."");

	function show_create_table($table)
{
$query = $this->write_query("SHOW CREATE TABLE ".$this->table_prefix.$table."");

Zeile 939Zeile 948
	 *
* @param string The name of the table.
* @return string Field info for that table

	 *
* @param string The name of the table.
* @return string Field info for that table

	 */

	 */

	function show_fields_from($table)
{
$query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table."");

	function show_fields_from($table)
{
$query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table."");

Zeile 952Zeile 961

/**
* Returns whether or not the table contains a fulltext index.


/**
* Returns whether or not the table contains a fulltext index.

	 *
* @param string The name of the table.

	 *
* @param string The name of the table.

	 * @param string Optionally specify the name of the index.
* @return boolean True or false if the table has a fulltext index or not.
*/

	 * @param string Optionally specify the name of the index.
* @return boolean True or false if the table has a fulltext index or not.
*/

Zeile 967Zeile 976
				return true;
}
else

				return true;
}
else

			{

			{

				return false;
}
}

				return false;
}
}

Zeile 980Zeile 989

/**
* Returns whether or not this database engine supports fulltext indexing.


/**
* Returns whether or not this database engine supports fulltext indexing.

	 *

	 *

	 * @param string The table to be checked.
* @return boolean True or false if supported or not.
*/

	 * @param string The table to be checked.
* @return boolean True or false if supported or not.
*/

Zeile 992Zeile 1001
		$status = $this->fetch_array($query);
$table_type = my_strtoupper($status['Engine']);
if($version >= '3.23.23' && $table_type == 'MYISAM')

		$status = $this->fetch_array($query);
$table_type = my_strtoupper($status['Engine']);
if($version >= '3.23.23' && $table_type == 'MYISAM')

		{
return true;
}

		{
return true;
}

		return false;
}


		return false;
}


Zeile 1036Zeile 1045
	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 1167
	 */
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;
}