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 2163 2006-08-30 05:53:05Z chris $
| * $Id: db_mysql.php 3030 2007-04-26 00:19:47Z Tikitiki $
|
*/
class databaseEngine
| */
class databaseEngine
|
Zeile 83 | Zeile 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 91 | Zeile 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 142 | Zeile 149 |
---|
* @param string The time it took to perform the query. */ function explain_query($string, $qtime)
|
* @param string The time it took to perform the query. */ 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 201 |
---|
{ $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 246 | Zeile 258 |
---|
* @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 257 | Zeile 269 |
---|
* @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 270 | Zeile 282 |
---|
{ $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 298 | Zeile 317 |
---|
*/ function error() {
|
*/ function error() {
|
return mysql_error($this->link);
| if($this->link) { return mysql_error($this->link); } else { return mysql_error(); }
|
}
/**
| }
/**
|
Zeile 310 | Zeile 336 |
---|
{ 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; }
|
Zeile 393 | Zeile 419 |
---|
*/ function field_exists($field, $table) {
|
*/ function field_exists($field, $table) {
|
global $db;
| |
$err = $this->error_reporting; $this->error_reporting = 0; $query = $this->query("
| $err = $this->error_reporting; $this->error_reporting = 0; $query = $this->query("
|