Vergleich inc/db_mysqli.php - 1.4.3 - 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 4138 2008-08-21 20:23:13Z 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 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.

	 *

	 *

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

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

Zeile 566Zeile 575

/**
* Return the number of fields.


/**
* Return the number of fields.

	 *

	 *

	 * @param resource The query data.
* @return int The number of fields.
*/
function num_fields($query)

	 * @param resource The query data.
* @return int The number of fields.
*/
function num_fields($query)

	{

	{

		return mysqli_num_fields($query);
}


		return mysqli_num_fields($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 814Zeile 823
			UPDATE {$this->table_prefix}$table
SET $query
");

			UPDATE {$this->table_prefix}$table
SET $query
");

	}

	}


/**
* Build a delete query.


/**
* Build a delete query.

Zeile 828Zeile 837
	{
$query = "";
if(!empty($where))

	{
$query = "";
if(!empty($where))

		{

		{

			$query .= " WHERE $where";

			$query .= " WHERE $where";

		}

		}

		if(!empty($limit))
{
$query .= " LIMIT $limit";

		if(!empty($limit))
{
$query .= " LIMIT $limit";

Zeile 840Zeile 849

/**
* Escape a string according to the MySQL escape format.


/**
* Escape a string according to the MySQL escape format.

	 *
* @param string The string to be escaped.
* @return string The escaped string.

	 *
* @param string The string to be escaped.
* @return string The escaped string.

	 */
function escape_string($string)
{
if(function_exists("mysqli_real_escape_string") && $this->read_link)
{
$string = mysqli_real_escape_string($this->read_link, $string);

	 */
function escape_string($string)
{
if(function_exists("mysqli_real_escape_string") && $this->read_link)
{
$string = mysqli_real_escape_string($this->read_link, $string);

		}

		}

		else
{
$string = addslashes($string);
}
return $string;

		else
{
$string = addslashes($string);
}
return $string;

	}


	}


	/**
* Frees the resources of a MySQLi query.
*

	/**
* Frees the resources of a MySQLi query.
*

Zeile 870Zeile 879
	
/**
* Escape a string used within a like command.

	
/**
* Escape a string used within a like command.

	 *

	 *

	 * @param string The string to be escaped.
* @return string The escaped string.
*/

	 * @param string The string to be escaped.
* @return string The escaped string.
*/

Zeile 898Zeile 907
			$this->version = intval($version[0]).".".intval($version[1]).".".intval($version[2]);
}
return $this->version;

			$this->version = intval($version[0]).".".intval($version[1]).".".intval($version[2]);
}
return $this->version;

	}

	}





	/**

	/**

	 * Optimizes a specific table.
*
* @param string The name of the table to be optimized.

	 * Optimizes a specific table.
*
* @param string The name of the table to be optimized.

Zeile 912Zeile 921
	
/**
* Analyzes a specific table.

	
/**
* Analyzes a specific table.

	 *

	 *

	 * @param string The name of the table to be analyzed.
*/
function analyze_table($table)

	 * @param string The name of the table to be analyzed.
*/
function analyze_table($table)

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