Xmf\Database\Tables
inspired by Yii CDbMigration
Build a work queue of database changes needed to implement new and changed tables. Define table(s) you are dealing with and any desired change(s). If the changes are already in place (i.e. the new column already exists) no work is added. Then executeQueue() to process the whole set.
Methods | ||
---|---|---|
public
|
__construct()
|
# |
protected
|
name(string $table): string
|
# |
public
|
addColumn(string $table, string $column, string $attributes): bool
|
# |
public
|
addPrimaryKey(string $table, string $column): bool
|
# |
public
|
addIndex(string $name, string $table, string $column, bool $unique = false): bool
|
# |
protected
|
quoteIndexColumnName(string $columnName): string
|
# |
public
|
addTable(string $table): bool
|
# |
public
|
useTable(string $table): bool
|
# |
public
|
getColumnAttributes(string $table, string $column): string|false
|
# |
public
|
getTableIndexes(string $table): array|false
|
# |
public
|
alterColumn(string $table, string $column, string $attributes, string $newName = ''): bool
|
# |
public
|
copyTable(string $table, string $newTable, bool $withData = false): bool
|
# |
public
|
dropColumn(string $table, string $column): bool
|
# |
public
|
dropIndex(string $name, string $table): bool
|
# |
public
|
dropIndexes(string $table): bool
|
# |
public
|
dropPrimaryKey(string $table): bool
|
# |
public
|
dropTable(string $table): bool
|
# |
public
|
renameTable(string $table, string $newName): bool
|
# |
public
|
setTableOptions(string $table, string $options): bool
|
# |
public
|
resetQueue(): void
|
# |
public
|
executeQueue(bool $force = false): bool
|
# |
public
|
delete(string $table, string|CriteriaElement $criteria): bool
|
# |
public
|
insert(string $table, array $columns, boolean $quoteValue = true): boolean
|
# |
public
|
update(string $table, array $columns, string|CriteriaElement $criteria, boolean $quoteValue = true): boolean
|
# |
public
|
truncate(string $table): bool
|
# |
protected
|
renderTableCreate(string $table, bool $prefixed = false): string|false
|
# |
protected
|
execSql(string $sql, bool $force = false): mixed
|
# |
protected
|
fetch(resource $result): mixed
|
# |
protected
|
quoteDefaultClause(string|null $default): string
|
# |
protected
|
getTable(string $table): array|bool
|
# |
protected
|
expandQueue(): void
|
# |
public
|
getLastError(): string
|
# |
public
|
getLastErrNo(): int
|
# |
public
|
dumpTables(): array
|
# |
public
|
dumpQueue(): array
|
# |
public
|
addToQueue(string $sql): void
|
# |
protected
|
tableNotEstablished(): false
|
# |
Properties | |||
---|---|---|---|
protected
|
XoopsDatabase
|
$db
|
# |
protected
|
string
|
$databaseName
|
# |
protected
|
array
|
$tables
|
# |
protected
|
array
|
$queue
|
# |
protected
|
string
|
$lastError
|
# |
protected
|
int
|
$lastErrNo
|
# |