com\setasign\SetaFramework\Database\Manager\Driver

Mysql Class Mysql

File: /SetaFramework/src/Database/Manager/Driver/Mysql.php

Class hierarchy

Summary

Properties


Methods

createTypeInstance()

protected Mysql::createTypeInstance (
string $columnName,
string $type,
?string $collation,
bool $allowNull,
?scalar $default,
string $extra
): \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn

Creates a columnObject from the databaseType

Parameters
$columnName : string
 
$type : string
 
$collation : ?string
 
$allowNull : bool
 
$default : ?scalar
 
$extra : string
 

dropTable()

public Mysql::dropTable (
string $tableName
): void

Drops a table.

Parameters
$tableName : string
 

getAlterDefinition()

public Mysql::getAlterDefinition (
string $originalTableName,
array{columnOrder: string[], addColumns: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn[], modifyColumns: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn[], changeColumns: array<string, array{oldName: string, column: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn}>, dropColumns: string[], addKeys: array<string, array{type: string, columns: string[]}>, dropKeys: string[], changeTableName: string|false, changeEngine: string|false, changeTableCollation: string|false} $changes
): string

Returns the sql command for alter the table.

$changes: all entries are arrays, following keys are used:

KeyDescription
addColumns & modifyColumnsvalue = AbstractColumn $column
changeColumnskey = string $oldColumnName; value = AbstractColumn $column
dropColumnsvalue = string $columnName
addKeyskey = string $indexName; value = array('type' => int $indexType; 'columns' => string[] $columns)
dropKeysvalue = string $indexName
Parameters
$originalTableName : string
 
$changes : array{columnOrder: string[], addColumns: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn[], modifyColumns: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn[], changeColumns: array<string, array{oldName: string, column: \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn}>, dropColumns: string[], addKeys: array<string, array{type: string, columns: string[]}>, dropKeys: string[], changeTableName: string|false, changeEngine: string|false, changeTableCollation: string|false}
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

getColumnDefinition()

Returns the column definition for the column as string.

Parameters
$column : \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn
 

getCreateDefinition()

public Mysql::getCreateDefinition (
\com\setasign\SetaFramework\Database\Manager\TableSchema $tableSchema,
bool $ifNotExist = false
): string

Returns the sql command for creating the table

Parameters
$tableSchema : \com\setasign\SetaFramework\Database\Manager\TableSchema
 
$ifNotExist : bool
 
Exceptions

Throws \com\setasign\SetaFramework\Exception

getDefaultCollation()

public Mysql::getDefaultCollation (
void
): string

getDefaultEngine()

public Mysql::getDefaultEngine (
void
): ?string

getDropTableQuery()

public Mysql::getDropTableQuery (
string $tableName
): string
Parameters
$tableName : string
 

getTableNames()

public Mysql::getTableNames (
void
): array

Return the names of all tables in the database.

getTableSchema()

Returns the tableSchema for the table.

The table must already exist in the database.

Parameters
$tableName : string
 

getTypeName()

Returns the columnType for the db from the columnObject

Parameters
$column : \com\setasign\SetaFramework\Database\Manager\Column\AbstractColumn
 

hasColumn()

public Mysql::hasColumn (
string $tableName,
string $column
): bool

Checks whether a column exists (with as little overhead as possible).

Parameters
$tableName : string
 
$column : string
 

hasTable()

public Mysql::hasTable (
string $tableName
): bool

Checks whether a table exist.

Parameters
$tableName : string
 

renameTable()

public Mysql::renameTable (
string $oldTableName,
string $newTableName
): void

Renames a table.

Mustn't be used if there exists a tableSchema for the table! (Only in TableSchema::rename)

Parameters
$oldTableName : string
 
$newTableName : string