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 1370 2006-04-16 13:47:01Z chris $ */
| * * $Id: db_mysql.php 1370 2006-04-16 13:47:01Z chris $ */
|
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)
|
{ $this->link = @mysqli_connect($hostname, $username, $password) or $this->dberror(); return $this->link;
| { $this->link = @mysqli_connect($hostname, $username, $password) or $this->dberror(); return $this->link;
|
Zeile 136 | Zeile 136 |
---|
*/ 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 174 | Zeile 179 |
---|
$this->explain .= "<tr>\n". "<td colspan=\"8\" style=\"background-color: #fff;\">Query Time: ".$qtime."</td>\n".
|
$this->explain .= "<tr>\n". "<td colspan=\"8\" style=\"background-color: #fff;\">Query Time: ".$qtime."</td>\n".
|
"</tr>\n". "</table>\n". "<br />\n";
| "</tr>\n". "</table>\n". "<br />\n";
|
} else { $this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
|
} else { $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". "</tr>\n".
| "<tr>\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". "</tr>\n".
|
Zeile 192 | Zeile 197 |
---|
"</tr>\n". "</table>\n". "<br />\n";
|
"</tr>\n". "</table>\n". "<br />\n";
|
}
| }
|
$this->querylist[$this->query_count]['query'] = $string; $this->querylist[$this->query_count]['time'] = $qtime;
|
$this->querylist[$this->query_count]['query'] = $string; $this->querylist[$this->query_count]['time'] = $qtime;
|
}
| }
|
/**
|
/**
|
Zeile 210 | Zeile 215 |
---|
{ $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 231 | Zeile 236 |
---|
/** * Moves internal row pointer to the next row
|
/** * Moves internal row pointer to the next row
|
*
| *
|
* @param resource The query ID. * @param int The pointer to move the row to.
|
* @param resource The query ID. * @param int The pointer to move the row to.
|
*/
| */
|
function data_seek($query, $row)
|
function data_seek($query, $row)
|
{
| {
|
return mysqli_data_seek($query, $row); }
| return mysqli_data_seek($query, $row); }
|
Zeile 249 | Zeile 254 |
---|
function num_rows($query) { return mysqli_num_rows($query);
|
function num_rows($query) { return mysqli_num_rows($query);
|
}
| }
|
/** * Return the last id number of inserted data.
| /** * Return the last id number of inserted data.
|
Zeile 278 | Zeile 283 |
---|
*/ function errno() {
|
*/ function errno() {
|
//return mysqli_errno($this->link);
| if(!$this->link) { return mysqli_connect_errno(); } else { return mysqli_errno($this->link); }
|
}
/**
| }
/**
|
Zeile 288 | Zeile 300 |
---|
*/ function error() {
|
*/ function error() {
|
return mysqli_error($this->link);
| if (!$this->link) { return mysqli_connect_error(); } else { return mysqli_error($this->link); }
|
}
/**
| }
/**
|
Zeile 377 | Zeile 396 |
---|
*/ 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'");
|