Vergleich inc/db_mysqli.php - 1.2.0 - 1.2.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright © 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright © 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: db_mysql.php 1370 2006-04-16 13:47:01Z chris $

 * $Id: db_mysqli.php 3352 2007-09-30 08:17:16Z chris $

 */

class databaseEngine

 */

class databaseEngine

Zeile 83Zeile 83
	 * @param boolean 1 if persistent connection, 0 if not.
* @return resource The database connection resource.
*/

	 * @param boolean 1 if persistent connection, 0 if not.
* @return resource The database connection resource.
*/

	function connect($hostname="localhost", $username="root", $password="", $pconnect=0)

	function connect($hostname="localhost", $username="root", $password="", $pconnect=0, $newlink=false)

	{

	{

		$this->link = @mysqli_connect($hostname, $username, $password) or $this->dberror();









		list($hostname, $port) = explode(":", $hostname, 2);
if($port)
{
$this->link = @mysqli_connect($hostname, $username, $password, "", $port) or $this->dberror();
}
else
{
$this->link = @mysqli_connect($hostname, $username, $password) or $this->dberror();
}

		return $this->link;
}


		return $this->link;
}


Zeile 97Zeile 105
	 */
function select_db($database)
{

	 */
function select_db($database)
{

		return @mysqli_select_db($this->link, $database) or $this->dberror();








		global $config;

$success = @mysqli_select_db($this->link, $database) or $this->dberror();
if($success && $config['db_encoding'])
{
$this->query("SET NAMES '{$config['db_encoding']}'");
}
return $success;

	}

/**

	}

/**

Zeile 136Zeile 151
	 */
function explain_query($string, $qtime)
{

	 */
function explain_query($string, $qtime)
{

 
		global $plugins;
if($plugins->current_hook)
{
$debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";
}

		if(preg_match("#^\s*select#i", $string))
{
$query = mysqli_query($this->link, "EXPLAIN $string");
$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

		if(preg_match("#^\s*select#i", $string))
{
$query = mysqli_query($this->link, "EXPLAIN $string");
$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

				"<td colspan=\"8\" style=\"background-color: #ccc;\"><strong>#".$this->query_count." - Select Query</strong></td>\n".

				"<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".

				"</tr>\n".
"<tr>\n".
"<td colspan=\"8\" style=\"background-color: #fefefe;\"><span style=\"font-family: Courier; font-size: 14px;\">".$string."</span></td>\n".

				"</tr>\n".
"<tr>\n".
"<td colspan=\"8\" style=\"background-color: #fefefe;\"><span style=\"font-family: Courier; font-size: 14px;\">".$string."</span></td>\n".

Zeile 182Zeile 202
		{
$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

		{
$this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
"<tr>\n".

				"<td style=\"background-color: #ccc;\"><strong>#".$this->query_count." - Write Query</strong></td>\n".

				"<td style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Write Query</strong></div></td>\n".

				"</tr>\n".
"<tr style=\"background-color: #fefefe;\">\n".
"<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".

				"</tr>\n".
"<tr style=\"background-color: #fefefe;\">\n".
"<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".

Zeile 210Zeile 230
	{
$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 260Zeile 280
	{
$id = mysqli_insert_id($this->link);
return $id;

	{
$id = mysqli_insert_id($this->link);
return $id;

	}

/**

	}

/**

	 * Close the connection with the DBMS.

	 * Close the connection with the DBMS.

	 *
*/

	 *
*/

	function close()
{
@mysqli_close($this->link);

	function close()
{
@mysqli_close($this->link);

	}

/**

	}

/**

	 * Return an error number.
*
* @return int The error number of the current error.
*/
function errno()

	 * Return an error number.
*
* @return int The error number of the current error.
*/
function errno()

	{
//return mysqli_errno($this->link);








	{
if(!$this->link)
{
return mysqli_connect_errno();
}
else
{
return mysqli_errno($this->link);
}

	}

/**

	}

/**

Zeile 288Zeile 315
	 */
function error()
{

	 */
function error()
{

		return mysqli_error($this->link);








		if (!$this->link) 
{
return mysqli_connect_error();
}
else
{
return mysqli_error($this->link);
}

	}

/**

	}

/**

Zeile 377Zeile 411
	 */
function field_exists($field, $table)
{

	 */
function field_exists($field, $table)
{

		global $db;

 
		$err = $this->error_reporting;
$this->error_reporting = 0;
$query = $this->query("SHOW COLUMNS FROM $table LIKE '$field'");

		$err = $this->error_reporting;
$this->error_reporting = 0;
$query = $this->query("SHOW COLUMNS FROM $table LIKE '$field'");