Vergleich inc/db_mysql.php - 1.2.2 - 1.2.12

  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 2209 2006-09-10 03:18:29Z Tikitiki $

 * $Id: db_mysql.php 3251 2007-07-31 03:24:36Z Tikitiki $

 */

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)

	{
if($pconnect)
{

	{
if($pconnect)
{

Zeile 91Zeile 91
		}
else
{

		}
else
{

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








			if(phpversion() < '4.2.0')
{
$this->link = @mysql_connect($hostname, $username, $password) or $this->dberror();
}
else
{
$this->link = @mysql_connect($hostname, $username, $password, $newlink) or $this->dberror();
}

		}
return $this->link;
}

		}
return $this->link;
}

Zeile 104Zeile 111
	 */
function select_db($database)
{

	 */
function select_db($database)
{

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








		global $config;

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

	}

/**

	}

/**

Zeile 143Zeile 157
	 */
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 = mysql_query("EXPLAIN $string", $this->link);
$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 = mysql_query("EXPLAIN $string", $this->link);
$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 189Zeile 208
		{
$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 221Zeile 240

/**
* Return a specific field from a query.


/**
* Return a specific field from a query.

	 *

	 *

	 * @param resource The query ID.
* @param string The name of the field to return.
* @param int The number of the row to fetch it from.

	 * @param resource The query ID.
* @param string The name of the field to return.
* @param int The number of the row to fetch it from.

	 */

	 */

	function fetch_field($query, $field, $row=false)
{
if($row === false)

	function fetch_field($query, $field, $row=false)
{
if($row === false)

Zeile 246Zeile 265
	 * @param int The pointer to move the row to.
*/
function data_seek($query, $row)

	 * @param int The pointer to move the row to.
*/
function data_seek($query, $row)

	{

	{

		return mysql_data_seek($query, $row);

		return mysql_data_seek($query, $row);

	}

	}


/**
* Return the number of rows resulting from a query.


/**
* Return the number of rows resulting from a query.

Zeile 257Zeile 276
	 * @return int The number of rows in the result.
*/
function num_rows($query)

	 * @return int The number of rows in the result.
*/
function num_rows($query)

	{

	{

		return mysql_num_rows($query);

		return mysql_num_rows($query);

	}


	}


	/**
* Return the last id number of inserted data.
*

	/**
* Return the last id number of inserted data.
*

Zeile 270Zeile 289
	{
$id = mysql_insert_id($this->link);
return $id;

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

	}


	}


	/**
* Close the connection with the DBMS.

	/**
* Close the connection with the DBMS.

	 *
*/

	 *
*/

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

	function close()
{
@mysql_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 mysql_errno($this->link);








	{
if($this->link)
{
return mysql_errno($this->link);
}
else
{
return mysql_errno();
}

	}

/**

	}

/**

Zeile 298Zeile 324
	 */
function error()
{

	 */
function error()
{

		return mysql_error($this->link);








		if($this->link)
{
return mysql_error($this->link);
}
else
{
return mysql_error();
}

	}

/**

	}

/**

Zeile 310Zeile 343
	{
if($this->error_reporting)
{

	{
if($this->error_reporting)
{

			echo "MySQL error: " . mysql_errno($this->link);
echo "<br />" . mysql_error($this->link);

			echo "MySQL error: " . $this->errno();
echo "<br />" . $this->error();

			echo "<br />Query: $string";
exit;
}

			echo "<br />Query: $string";
exit;
}