Zeile 190 | Zeile 190 |
---|
if(array_key_exists('hostname', $connections[$type])) { $details = $connections[$type];
|
if(array_key_exists('hostname', $connections[$type])) { $details = $connections[$type];
|
unset($connections);
| unset($connections[$type]);
|
$connections[$type][] = $details; }
| $connections[$type][] = $details; }
|
Zeile 485 | Zeile 485 |
---|
$this->data_seek($query, $row); } $array = $this->fetch_array($query);
|
$this->data_seek($query, $row); } $array = $this->fetch_array($query);
|
return $array[$field];
| if($array !== null) { return $array[$field]; } return null;
|
}
/**
| }
/**
|
Zeile 498 | Zeile 502 |
---|
function data_seek($query, $row) { return mysqli_data_seek($query, $row);
|
function data_seek($query, $row) { return mysqli_data_seek($query, $row);
|
}
| }
|
/** * Return the number of rows resulting from a query. *
| /** * Return the number of rows resulting from a query. *
|
Zeile 513 | Zeile 517 |
---|
/** * Return the last id number of inserted data.
|
/** * Return the last id number of inserted data.
|
*
| *
|
* @return int The id number.
|
* @return int The id number.
|
*/
| */
|
function insert_id() { $id = mysqli_insert_id($this->current_link);
| function insert_id() { $id = mysqli_insert_id($this->current_link);
|
Zeile 527 | Zeile 531 |
---|
* */ function close()
|
* */ function close()
|
{
| {
|
@mysqli_close($this->read_link); if($this->write_link) {
| @mysqli_close($this->read_link); if($this->write_link) {
|
Zeile 554 | Zeile 558 |
---|
/** * Return an error string.
|
/** * Return an error string.
|
*
| *
|
* @return string The explanation for the current error. */ function error_string() { if($this->current_link)
|
* @return string The explanation for the current error. */ function error_string() { if($this->current_link)
|
{
| {
|
return mysqli_error($this->current_link); } else
| return mysqli_error($this->current_link); } else
|
Zeile 568 | Zeile 572 |
---|
return mysqli_connect_error(); } }
|
return mysqli_connect_error(); } }
|
|
|
/** * Output a database error. *
| /** * Output a database error. *
|
Zeile 582 | Zeile 586 |
---|
if(class_exists("errorHandler")) { global $error_handler;
|
if(class_exists("errorHandler")) { global $error_handler;
|
|
|
if(!is_object($error_handler)) { require_once MYBB_ROOT."inc/class_error.php";
| if(!is_object($error_handler)) { require_once MYBB_ROOT."inc/class_error.php";
|
Zeile 595 | Zeile 599 |
---|
"query" => $string ); $error_handler->error(MYBB_SQL, $error);
|
"query" => $string ); $error_handler->error(MYBB_SQL, $error);
|
}
| }
|
else { trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
| else { trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
|
Zeile 815 | Zeile 819 |
---|
} $array[$field] = $value;
|
} $array[$field] = $value;
|
}
| }
|
else { $array[$field] = $this->quote_val($value);
| else { $array[$field] = $this->quote_val($value);
|
Zeile 1034 | Zeile 1038 |
---|
* @return string The escaped string. */ function escape_string_like($string)
|
* @return string The escaped string. */ function escape_string_like($string)
|
{ return $this->escape_string(str_replace(array('%', '_') , array('\\%' , '\\_') , $string));
| { return $this->escape_string(str_replace(array('\\', '%', '_') , array('\\\\', '\\%' , '\\_') , $string));
|
}
/**
| }
/**
|
Zeile 1048 | Zeile 1052 |
---|
if($this->version) { return $this->version;
|
if($this->version) { return $this->version;
|
}
| }
|
|
|
$version = @mysqli_get_server_info($this->read_link); if(!$version) { $query = $this->query("SELECT VERSION() as version"); $ver = $this->fetch_array($query); $version = $ver['version']; }
| $query = $this->query("SELECT VERSION() as version"); $ver = $this->fetch_array($query); $version = $ver['version'];
|
if($version) {
| if($version) {
|
Zeile 1068 | Zeile 1068 |
---|
/** * Optimizes a specific table.
|
/** * Optimizes a specific table.
|
*
| *
|
* @param string $table The name of the table to be optimized. */ function optimize_table($table)
| * @param string $table The name of the table to be optimized. */ function optimize_table($table)
|
Zeile 1107 | Zeile 1107 |
---|
* @return array Field info for that table */ function show_fields_from($table)
|
* @return array Field info for that table */ function show_fields_from($table)
|
{
| {
|
$query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table.""); $field_info = array(); while($field = $this->fetch_array($query))
| $query = $this->write_query("SHOW FIELDS FROM ".$this->table_prefix.$table.""); $field_info = array(); while($field = $this->fetch_array($query))
|
Zeile 1147 | Zeile 1147 |
---|
/** * Returns whether or not this database engine supports fulltext indexing.
|
/** * Returns whether or not this database engine supports fulltext indexing.
|
* * @param string $table The table to be checked. * @return boolean True or false if supported or not. */
| * * @param string $table The table to be checked. * @return boolean True or false if supported or not. */
|
function supports_fulltext($table) {
| function supports_fulltext($table) {
|
Zeile 1159 | Zeile 1159 |
---|
$status = $this->fetch_array($query); $table_type = my_strtoupper($status['Engine']); if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))
|
$status = $this->fetch_array($query); $table_type = my_strtoupper($status['Engine']); if(version_compare($version, '3.23.23', '>=') && ($table_type == 'MYISAM' || $table_type == 'ARIA'))
|
{ return true; }
| { return true; }
|
elseif(version_compare($version, '5.6', '>=') && $table_type == 'INNODB') { return true;
| elseif(version_compare($version, '5.6', '>=') && $table_type == 'INNODB') { return true;
|
Zeile 1171 | Zeile 1171 |
---|
/** * Returns whether or not this database engine supports boolean fulltext matching.
|
/** * Returns whether or not this database engine supports boolean fulltext matching.
|
*
| *
|
* @param string $table The table to be checked. * @return boolean True or false if supported or not. */
| * @param string $table The table to be checked. * @return boolean True or false if supported or not. */
|
Zeile 1180 | Zeile 1180 |
---|
$version = $this->get_version(); $supports_fulltext = $this->supports_fulltext($table); if(version_compare($version, '4.0.1', '>=') && $supports_fulltext == true)
|
$version = $this->get_version(); $supports_fulltext = $this->supports_fulltext($table); if(version_compare($version, '4.0.1', '>=') && $supports_fulltext == true)
|
{ return true; } return false;
| { return true; } return false;
|
}
/**
| }
/**
|
Zeile 1220 | Zeile 1220 |
---|
* @param string $table The name of the table. * @param string $column Name of the column to be indexed. * @param string $name The index name, optional.
|
* @param string $table The name of the table. * @param string $column Name of the column to be indexed. * @param string $name The index name, optional.
|
*/
| */
|
function create_fulltext_index($table, $column, $name="") { $this->write_query("ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)");
| function create_fulltext_index($table, $column, $name="") { $this->write_query("ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)");
|
Zeile 1245 | Zeile 1245 |
---|
* @param boolean $table_prefix use table prefix */ function drop_table($table, $hard=false, $table_prefix=true)
|
* @param boolean $table_prefix use table prefix */ function drop_table($table, $hard=false, $table_prefix=true)
|
{ if($table_prefix == false) { $table_prefix = ""; } else { $table_prefix = $this->table_prefix; }
if($hard == false) { $this->write_query('DROP TABLE IF EXISTS '.$table_prefix.$table); } else {
| { if($table_prefix == false) { $table_prefix = ""; } else { $table_prefix = $this->table_prefix; }
if($hard == false) { $this->write_query('DROP TABLE IF EXISTS '.$table_prefix.$table); } else {
|
$this->write_query('DROP TABLE '.$table_prefix.$table); } }
| $this->write_query('DROP TABLE '.$table_prefix.$table); } }
|
Zeile 1274 | Zeile 1274 |
---|
* @return mysqli_result */ function rename_table($old_table, $new_table, $table_prefix=true)
|
* @return mysqli_result */ function rename_table($old_table, $new_table, $table_prefix=true)
|
{
| {
|
if($table_prefix == false) { $table_prefix = "";
| if($table_prefix == false) { $table_prefix = "";
|
Zeile 1292 | Zeile 1292 |
---|
* * @param string $table The table * @param array $replacements The replacements
|
* * @param string $table The table * @param array $replacements The replacements
|
| * @param string|array $default_field The default field(s) * @param boolean $insert_id Whether or not to return an insert id. True by default
|
* @return mysqli_result|bool */
|
* @return mysqli_result|bool */
|
function replace_query($table, $replacements=array())
| function replace_query($table, $replacements=array(), $default_field="", $insert_id=true)
|
{ global $mybb;
| { global $mybb;
|
Zeile 1329 | Zeile 1331 |
---|
/** * Drops a column
|
/** * Drops a column
|
* * @param string $table The table
| * * @param string $table The table
|
* @param string $column The column name * @return mysqli_result */ function drop_column($table, $column) {
|
* @param string $column The column name * @return mysqli_result */ function drop_column($table, $column) {
|
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} DROP {$column}");
| $column = trim($column, '`');
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} DROP `{$column}`");
|
}
/**
| }
/**
|
Zeile 1349 | Zeile 1353 |
---|
*/ function add_column($table, $column, $definition) {
|
*/ function add_column($table, $column, $definition) {
|
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ADD {$column} {$definition}");
| $column = trim($column, '`');
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} ADD `{$column}` {$definition}");
|
}
/**
| }
/**
|
Zeile 1357 | Zeile 1363 |
---|
* * @param string $table The table * @param string $column The column name
|
* * @param string $table The table * @param string $column The column name
|
* @param string $new_definition the new column definition * @return mysqli_result */ function modify_column($table, $column, $new_definition)
| * @param string $new_definition the new column definition * @param boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false) * @param boolean|string $new_default_value The new default value, or false to drop the attribute * @return bool Returns true if all queries are executed successfully or false if one of them failed */ function modify_column($table, $column, $new_definition, $new_not_null=false, $new_default_value=false)
|
{
|
{
|
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY {$column} {$new_definition}");
| $column = trim($column, '`');
if($new_not_null !== false) { if(strtolower($new_not_null) == "set") { $not_null = "NOT NULL"; } else { $not_null = "NULL"; } } else { $not_null = ''; }
if($new_default_value !== false) { $default = "DEFAULT ".$new_default_value; } else { $default = ''; }
return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY `{$column}` {$new_definition} {$not_null} {$default}");
|
}
/**
| }
/**
|
Zeile 1372 | Zeile 1407 |
---|
* @param string $old_column The old column name * @param string $new_column the new column name * @param string $new_definition the new column definition
|
* @param string $old_column The old column name * @param string $new_column the new column name * @param string $new_definition the new column definition
|
* @return mysqli_result
| * @param boolean|string $new_not_null Whether to "drop" or "set" the NOT NULL attribute (no change if false) * @param boolean|string $new_default_value The new default value, or false to drop the attribute * @return bool Returns true if all queries are executed successfully
|
*/
|
*/
|
function rename_column($table, $old_column, $new_column, $new_definition)
| function rename_column($table, $old_column, $new_column, $new_definition, $new_not_null=false, $new_default_value=false)
|
{
|
{
|
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} CHANGE {$old_column} {$new_column} {$new_definition}");
| $old_column = trim($old_column, '`'); $new_column = trim($new_column, '`');
if($new_not_null !== false) { if(strtolower($new_not_null) == "set") { $not_null = "NOT NULL"; } else { $not_null = "NULL"; } } else { $not_null = ''; }
if($new_default_value !== false) { $default = "DEFAULT ".$new_default_value; } else { $default = ''; }
return (bool)$this->write_query("ALTER TABLE {$this->table_prefix}{$table} CHANGE `{$old_column}` `{$new_column}` {$new_definition} {$not_null} {$default}");
|
}
/**
| }
/**
|
Zeile 1458 | Zeile 1523 |
---|
'cp1251' => 'Windows Cyrillic', 'cp1256' => 'Windows Arabic', 'cp1257' => 'Windows Baltic',
|
'cp1251' => 'Windows Cyrillic', 'cp1256' => 'Windows Arabic', 'cp1257' => 'Windows Baltic',
|
'binary' => 'Binary pseudo charset',
| |
'geostd8' => 'GEOSTD8 Georgian', 'cp932' => 'SJIS for Windows Japanese', 'eucjpms' => 'UJIS for Windows Japanese',
| 'geostd8' => 'GEOSTD8 Georgian', 'cp932' => 'SJIS for Windows Japanese', 'eucjpms' => 'UJIS for Windows Japanese',
|
Zeile 1507 | Zeile 1571 |
---|
'cp1251' => 'cp1251_general_ci', 'cp1256' => 'cp1256_general_ci', 'cp1257' => 'cp1257_general_ci',
|
'cp1251' => 'cp1251_general_ci', 'cp1256' => 'cp1256_general_ci', 'cp1257' => 'cp1257_general_ci',
|
'binary' => 'binary',
| |
'geostd8' => 'geostd8_general_ci', 'cp932' => 'cp932_japanese_ci', 'eucjpms' => 'eucjpms_japanese_ci',
| 'geostd8' => 'geostd8_general_ci', 'cp932' => 'cp932_japanese_ci', 'eucjpms' => 'eucjpms_japanese_ci',
|