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 3902 2008-06-11 02:21:37Z 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 if(!array_key_exists('read', $config))
|
// Connecting to more than one server { // Specified multiple servers, but no specific read/write servers if(!array_key_exists('read', $config))
|
{
| {
|
foreach($config as $key => $settings) { if(is_int($key)) $connections['read'][] = $settings;
| foreach($config as $key => $settings) { if(is_int($key)) $connections['read'][] = $settings;
|
Zeile 157 | Zeile 158 |
---|
else { $connections = $config;
|
else { $connections = $config;
|
} }
$this->db_encoding = $config['encoding'];
| } }
$this->db_encoding = $config['encoding'];
|
// Actually connect to the specified servers foreach(array('read', 'write') as $type)
| // Actually connect to the specified servers foreach(array('read', 'write') as $type)
|
Zeile 196 | Zeile 197 |
---|
// Specified a custom port for this connection? list($hostname, $port) = explode(":", $single_connection['hostname'], 2); if($port)
|
// Specified a custom port for this connection? list($hostname, $port) = explode(":", $single_connection['hostname'], 2); if($port)
|
{
| {
|
$this->$link = @$connect_function($hostname, $single_connection['username'], $single_connection['password'], "", $port); } else
| $this->$link = @$connect_function($hostname, $single_connection['username'], $single_connection['password'], "", $port); } else
|
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;
|
Zeile 284 | Zeile 288 |
---|
* @param string The query SQL. * @param boolean 1 if hide errors, 0 if not. * @param integer 1 if executes on slave database, 0 if not.
|
* @param string The query SQL. * @param boolean 1 if hide errors, 0 if not. * @param integer 1 if executes on slave database, 0 if not.
|
* @return resource The query data. */
| * @return resource The query data. */
|
function query($string, $hide_errors=0, $write_query=0) { global $pagestarttime, $db, $mybb;
| function query($string, $hide_errors=0, $write_query=0) { global $pagestarttime, $db, $mybb;
|
Zeile 481 | Zeile 485 |
---|
@mysqli_close($this->read_link); if($this->write_link) {
|
@mysqli_close($this->read_link); if($this->write_link) {
|
@mysql_close($this->write_link);
| @mysqli_close($this->write_link);
|
} }
| } }
|
Zeile 550 | Zeile 554 |
---|
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; } }
|
/** * Returns the number of affected rows in a query. *
| /** * Returns the number of affected rows in a query. *
|
Zeile 563 | Zeile 571 |
---|
return mysqli_affected_rows($this->current_link); }
|
return mysqli_affected_rows($this->current_link); }
|
|
|
/** * Return the number of fields. * * @param resource The query data. * @return int The number of fields.
|
/** * Return the number of fields. * * @param resource The query data. * @return int The number of fields.
|
*/
| */
|
function num_fields($query) { return mysqli_num_fields($query);
| function num_fields($query) { return mysqli_num_fields($query);
|
Zeile 602 | Zeile 610 |
---|
/** * Check if a table exists in a database.
|
/** * Check if a table exists in a database.
|
* * @param string The table name. * @return boolean True when exists, false if not.
| * * @param string The table name. * @return boolean True when exists, false if not.
|
*/ function table_exists($table) {
| */ function table_exists($table) {
|
Zeile 614 | Zeile 622 |
---|
$query = $this->write_query(" SHOW TABLES LIKE '{$this->table_prefix}$table'
|
$query = $this->write_query(" SHOW TABLES LIKE '{$this->table_prefix}$table'
|
"); $exists = $this->num_rows($query); $this->error_reporting = $err; if($exists > 0) { return true; }
| "); $exists = $this->num_rows($query); $this->error_reporting = $err; if($exists > 0) { return true; }
|
else { return false;
| else { return false;
|
Zeile 654 | Zeile 662 |
---|
else { return false;
|
else { return false;
|
} }
/**
| } }
/**
|
* Add a shutdown query. * * @param resource The query data.
| * Add a shutdown query. * * @param resource The query data.
|
Zeile 692 | Zeile 700 |
---|
if($conditions != "") { $query .= " WHERE ".$conditions;
|
if($conditions != "") { $query .= " WHERE ".$conditions;
|
}
| }
|
if(isset($options['order_by']))
|
if(isset($options['order_by']))
|
{
| {
|
$query .= " ORDER BY ".$options['order_by']; if(isset($options['order_dir'])) { $query .= " ".my_strtoupper($options['order_dir']); }
|
$query .= " ORDER BY ".$options['order_by']; if(isset($options['order_dir'])) { $query .= " ".my_strtoupper($options['order_dir']); }
|
}
| }
|
if(isset($options['limit_start']) && isset($options['limit'])) {
| if(isset($options['limit_start']) && isset($options['limit'])) {
|
Zeile 710 | Zeile 718 |
---|
else if(isset($options['limit'])) { $query .= " LIMIT ".$options['limit'];
|
else if(isset($options['limit'])) { $query .= " LIMIT ".$options['limit'];
|
}
| }
|
return $this->query($query); }
| return $this->query($query); }
|
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 992 | Zeile 1000 |
---|
$status = $this->fetch_array($query); $table_type = my_strtoupper($status['Engine']); if($version >= '3.23.23' && $table_type == 'MYISAM')
|
$status = $this->fetch_array($query); $table_type = my_strtoupper($status['Engine']); if($version >= '3.23.23' && $table_type == 'MYISAM')
|
{ return true; } return false;
| { return true; } return false;
|
}
/**
| }
/**
|
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; }
|
Zeile 1277 | Zeile 1285 |
---|
} }
|
} }
|
if(!class_exists('databaseEngine')) { class databaseEngine extends DB_MySQLi { } }
| |
?>
| ?>
|