Zeile 3 | Zeile 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 2743 2007-02-09 00:05:26Z CraKteR $
| * $Id: db_mysql.php 3251 2007-07-31 03:24:36Z Tikitiki $
|
*/
class databaseEngine
| */
class databaseEngine
|
Zeile 91 | Zeile 91 |
---|
} else {
|
} else {
|
$this->link = @mysql_connect($hostname, $username, $password, $newlink) 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; }
/** * Selects the database to use.
|
} return $this->link; }
/** * Selects the database to use.
|
*
| *
|
* @param string The database name. * @return boolean True when successfully connected, false if not. */ function select_db($database)
|
* @param string The database name. * @return boolean True when successfully connected, false if not. */ 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; }
|
/** * Query the database.
| /** * Query the database.
|
Zeile 143 | Zeile 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 189 | Zeile 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".
|