Zeile 1307 | Zeile 1307 |
---|
* * @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 resource|bool */
|
* @return resource|bool */
|
function replace_query($table, $replacements=array())
| function replace_query($table, $replacements=array(), $default_field="", $insert_id=true)
|
{ global $mybb;
| { global $mybb;
|
Zeile 1351 | Zeile 1353 |
---|
*/ function drop_column($table, $column) {
|
*/ 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}`");
|
}
/** * Adds a column
|
}
/** * Adds a column
|
*
| *
|
* @param string $table The table * @param string $column The column name * @param string $definition the new column definition
|
* @param string $table The table * @param string $column The column name * @param string $definition the new column definition
|
* @return resource */
| * @return resource */
|
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}"); }
|
/** * Modifies a column *
| /** * Modifies a column *
|
Zeile 1376 | Zeile 1382 |
---|
* @return resource */ function modify_column($table, $column, $new_definition)
|
* @return resource */ function modify_column($table, $column, $new_definition)
|
{ return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY {$column} {$new_definition}");
| { $column = trim($column, '`');
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} MODIFY `{$column}` {$new_definition}");
|
}
/**
| }
/**
|
Zeile 1391 | Zeile 1399 |
---|
*/ function rename_column($table, $old_column, $new_column, $new_definition) {
|
*/ function rename_column($table, $old_column, $new_column, $new_definition) {
|
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, '`');
return $this->write_query("ALTER TABLE {$this->table_prefix}{$table} CHANGE `{$old_column}` `{$new_column}` {$new_definition}");
|
}
/**
| }
/**
|