Zeile 1057 | Zeile 1057 |
---|
return $this->version; }
|
return $this->version; }
|
$version = @mysql_get_server_info(); 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 1184 | Zeile 1180 |
---|
/** * Checks to see if an index exists on a specified table
|
/** * Checks to see if an index exists on a specified table
|
* * @param string $table The name of the table.
| * * @param string $table The name of the table.
|
* @param string $index The name of the index. * @return bool Whether or not the index exists in that table */
| * @param string $index The name of the index. * @return bool Whether or not the index exists in that table */
|
Zeile 1202 | Zeile 1198 |
---|
} }
|
} }
|
if($index_exists) { return true; }
| if($index_exists) { return true; }
|
return false; }
| return false; }
|
Zeile 1225 | Zeile 1221 |
---|
return true; } return false;
|
return true; } return false;
|
}
| }
|
/** * Creates a fulltext index on the specified column in the specified table with optional index name.
|
/** * Creates a fulltext index on the specified column in the specified table with optional index name.
|
*
| *
|
* @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.
|
Zeile 1239 | Zeile 1235 |
---|
$this->write_query(" ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)
|
$this->write_query(" ALTER TABLE {$this->table_prefix}$table ADD FULLTEXT $name ($column)
|
");
| ");
|
}
/** * Drop an index with the specified name from the specified table
|
}
/** * Drop an index with the specified name from the specified table
|
*
| *
|
* @param string $table The name of the table. * @param string $name The name of the index. */ function drop_index($table, $name)
|
* @param string $table The name of the table. * @param string $name The name of the index. */ function drop_index($table, $name)
|
{
| {
|
$this->write_query(" ALTER TABLE {$this->table_prefix}$table DROP INDEX $name
| $this->write_query(" ALTER TABLE {$this->table_prefix}$table DROP INDEX $name
|
Zeile 1264 | Zeile 1260 |
---|
* @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);
|
} }
| } }
|
/** * Renames a table *
| /** * Renames a table *
|
Zeile 1308 | Zeile 1304 |
---|
/** * Replace contents of table with values
|
/** * Replace contents of table with values
|
*
| *
|
* @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 1348 | Zeile 1346 |
---|
/** * Drops a column
|
/** * Drops a column
|
* * @param string $table The table * @param string $column The column name
| * * @param string $table The table * @param string $column The column name
|
* @return resource */ function drop_column($table, $column)
|
* @return resource */ 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 $table The table * @param string $column The column name
|
* @param string $definition the new column definition * @return resource */ function add_column($table, $column, $definition)
|
* @param string $definition the new column definition * @return resource */ 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
|
*
| *
|
* @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 resource */
| * @param string $new_definition the new column definition * @return resource */
|
function modify_column($table, $column, $new_definition) {
|
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 1395 | 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}");
|
}
/**
| }
/**
|