Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: db_mysqli.php 4067 2008-08-04 03:59:08Z Tikitiki $
| * $Id: db_mysqli.php 4261 2008-11-03 01:11:33Z Tikitiki $
|
*/
class DB_MySQLi
| */
class DB_MySQLi
|
Zeile 143 | Zeile 143 |
---|
{ $connections['read'][] = $config; }
|
{ $connections['read'][] = $config; }
|
| else
|
// Connecting to more than one server { // Specified multiple servers, but no specific read/write servers
| // Connecting to more than one server { // Specified multiple servers, but no specific read/write servers
|
Zeile 238 | Zeile 239 |
---|
}
// Select databases
|
}
// Select databases
|
$this->select_db($config['database']);
| if(!$this->select_db($config['database'])) { return false; }
|
$this->current_link = &$this->read_link; return $this->read_link;
|
$this->current_link = &$this->read_link; return $this->read_link;
|
}
/**
| }
/**
|
* Selects the database to use. * * @param string The database name.
| * Selects the database to use. * * @param string The database name.
|
Zeile 345 | Zeile 349 |
---|
if($plugins->current_hook) { $debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";
|
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->current_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;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
|
if(preg_match("#^\s*select#i", $string)) { $query = mysqli_query($this->current_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;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
|
"</tr>\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". "</tr>\n".
|
Zeile 384 | Zeile 388 |
---|
$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".
| "</tr>\n".
|
"</table>\n". "<br />\n"; }
| "</table>\n". "<br />\n"; }
|
Zeile 396 | Zeile 400 |
---|
"</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".
| "</tr>\n".
|
"<tr>\n". "<td bgcolor=\"#ffffff\">Query Time: ".$qtime."</td>\n". "</tr>\n". "</table>\n". "<br />\n";
|
"<tr>\n". "<td bgcolor=\"#ffffff\">Query Time: ".$qtime."</td>\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;
|
}
/**
| }
/**
|
* Return a result array for a query. * * @param resource The query data. * @param constant The type of array to return. * @return array The array of results.
|
* Return a result array for a query. * * @param resource The query data. * @param constant The type of array to return. * @return array The array of results.
|
*/
| */
|
function fetch_array($query) { $array = mysqli_fetch_assoc($query); return $array;
|
function fetch_array($query) { $array = mysqli_fetch_assoc($query); return $array;
|
}
| }
|
/** * 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.
|
/** * 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.
|
*/
| */
|
function fetch_field($query, $field, $row=false) { if($row !== false)
| function fetch_field($query, $field, $row=false) { if($row !== false)
|
Zeile 446 | Zeile 450 |
---|
* @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 mysqli_data_seek($query, $row); }
| return mysqli_data_seek($query, $row); }
|
Zeile 457 | Zeile 461 |
---|
* @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 mysqli_num_rows($query); }
/** * Return the last id number of inserted data.
|
return mysqli_num_rows($query); }
/** * Return the last id number of inserted data.
|
*
| *
|
* @return int The id number. */ function insert_id()
| * @return int The id number. */ function insert_id()
|
Zeile 474 | Zeile 478 |
---|
/** * Close the connection with the DBMS.
|
/** * Close the connection with the DBMS.
|
* */
| * */
|
function close() { @mysqli_close($this->read_link); if($this->write_link)
|
function close() { @mysqli_close($this->read_link); if($this->write_link)
|
{ @mysql_close($this->write_link); }
| { @mysqli_close($this->write_link); }
|
}
/**
| }
/**
|
Zeile 496 | Zeile 500 |
---|
{ return mysqli_errno($this->current_link); }
|
{ return mysqli_errno($this->current_link); }
|
else { return mysqli_connect_errno(); }
| else { return mysqli_connect_errno(); }
|
}
/** * Return an error string. * * @return string The explanation for the current error.
|
}
/** * Return an error string. * * @return string The explanation for the current error.
|
*/
| */
|
function error_string() { if($this->current_link) { return mysqli_error($this->current_link);
|
function error_string() { if($this->current_link) { return mysqli_error($this->current_link);
|
}
| }
|
else { return mysqli_connect_error();
| else { return mysqli_connect_error();
|
Zeile 549 | Zeile 553 |
---|
{ trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR); }
|
{ trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR); }
|
| } else { return false;
|
} }
| } }
|
Zeile 846 | Zeile 854 |
---|
*/ function escape_string($string) {
|
*/ function escape_string($string) {
|
if(function_exists("mysql_real_escape_string") && $this->read_link)
| if(function_exists("mysqli_real_escape_string") && $this->read_link)
|
{ $string = mysqli_real_escape_string($this->read_link, $string); }
| { $string = mysqli_real_escape_string($this->read_link, $string); }
|
Zeile 1131 | Zeile 1139 |
---|
*/ function fetch_db_charsets() {
|
*/ function fetch_db_charsets() {
|
if($this_link && $this->get_version() < 4.1)
| if($this->link && version_compare($this->get_version(), "4.1", "<"))
|
{ return false; }
| { return false; }
|