Vergleich inc/db_mysqli.php - 1.4.0 - 1.4.9

  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 3902 2008-06-11 02:21:37Z 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
if(!array_key_exists('read', $config))

		// Connecting to more than one server
{
// Specified multiple servers, but no specific read/write servers
if(!array_key_exists('read', $config))

			{

			{

				foreach($config as $key => $settings)
{
if(is_int($key)) $connections['read'][] = $settings;

				foreach($config as $key => $settings)
{
if(is_int($key)) $connections['read'][] = $settings;

Zeile 157Zeile 158
			else
{
$connections = $config;

			else
{
$connections = $config;

			}
}

$this->db_encoding = $config['encoding'];

			}
}

$this->db_encoding = $config['encoding'];


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)


// Actually connect to the specified servers
foreach(array('read', 'write') as $type)

Zeile 196Zeile 197
				// 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($hostname, $single_connection['username'], $single_connection['password'], "", $port);
}
else

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 284Zeile 288
	 * @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @param integer 1 if executes on slave database, 0 if not.

	 * @param string The query SQL.
* @param boolean 1 if hide errors, 0 if not.
* @param integer 1 if executes on slave database, 0 if not.

	 * @return resource The query data.
*/

	 * @return resource The query data.
*/

	function query($string, $hide_errors=0, $write_query=0)
{
global $pagestarttime, $db, $mybb;

	function query($string, $hide_errors=0, $write_query=0)
{
global $pagestarttime, $db, $mybb;

Zeile 481Zeile 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 550Zeile 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 563Zeile 571
		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 602Zeile 610

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


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

	 *
* @param string The table name.
* @return boolean True when exists, false if not.

	 *
* @param string The table name.
* @return boolean True when exists, false if not.

	 */
function table_exists($table)
{

	 */
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;

if($exists > 0)
{
return true;
}

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

if($exists > 0)
{
return true;
}

		else
{
return false;

		else
{
return false;

Zeile 654Zeile 662
		else
{
return false;

		else
{
return false;

		}
}

/**

		}
}

/**

	 * Add a shutdown query.
*
* @param resource The query data.

	 * Add a shutdown query.
*
* @param resource The query data.

Zeile 692Zeile 700
		if($conditions != "")
{
$query .= " WHERE ".$conditions;

		if($conditions != "")
{
$query .= " WHERE ".$conditions;

		}

		}

		
if(isset($options['order_by']))

		
if(isset($options['order_by']))

		{

		{

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

			$query .= " ORDER BY ".$options['order_by'];
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 710Zeile 718
		else if(isset($options['limit']))
{
$query .= " LIMIT ".$options['limit'];

		else if(isset($options['limit']))
{
$query .= " LIMIT ".$options['limit'];

		}


		}


		return $this->query($query);
}


		return $this->query($query);
}


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 992Zeile 1000
		$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 false;

		{
return true;
}
return false;

	}

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

	}

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

	 *

	 *

	 * @param string The table to be checked.
* @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

	 * @param string The table to be checked.
* @return boolean True or false if supported or not.
*/
function supports_fulltext_boolean($table)

	{

	{

		$version = $this->get_version();
$supports_fulltext = $this->supports_fulltext($table);
if($version >= '4.0.1' && $supports_fulltext == true)

		$version = $this->get_version();
$supports_fulltext = $this->supports_fulltext($table);
if($version >= '4.0.1' && $supports_fulltext == true)

		{
return true;
}
return false;
}

/**

		{
return true;
}
return false;
}

/**

	 * Creates a fulltext index on the specified column in the specified table with optional index name.
*
* @param string The name of the table.

	 * Creates a fulltext index on the specified column in the specified table with optional index name.
*
* @param string The name of the table.

Zeile 1025Zeile 1033
	function create_fulltext_index($table, $column, $name="")
{
$this->write_query("ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)");

	function create_fulltext_index($table, $column, $name="")
{
$this->write_query("ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)");

	}

	}





	/**

	/**

	 * Drop an index with the specified name from the specified table
*
* @param string The name of the table.
* @param string The name of the index.
*/

	 * Drop an index with the specified name from the specified table
*
* @param string The name of the table.
* @param string The name of the index.
*/

	function drop_index($table, $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)

	{

	{

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

















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

Zeile 1277Zeile 1312
	}
}


	}
}


if(!class_exists('databaseEngine'))
{
class databaseEngine extends DB_MySQLi {
}
}

 
?>

?>