Public Member Functions | |
__construct (protected ConnectionInterface $con) | |
dbt2udt (string $type,?int &$len, &$default) | |
udt2dbt (string $type,?int &$len, &$default) | |
getTables () | |
getColumns (string $table) | |
getKeys (string $table) | |
getIndexes (string $table) | |
getReferences (string $table) | |
createTable (string $name, array $fields) | |
createField (string $table, string $name, string $type,?int $len, bool $null, $default) | |
createPrimary (string $table, string $name, array $fields) | |
createUnique (string $table, string $name, array $fields) | |
createIndex (string $table, string $name, string $type, array $fields) | |
createReference (string $name, string $table, array $fields, string $foreign_table, array $foreign_fields, $update, $delete) | |
alterField (string $table, string $name, string $type,?int $len, bool $null, $default) | |
alterPrimary (string $table, string $name, string $newname, array $fields) | |
alterUnique (string $table, string $name, string $newname, array $fields) | |
alterIndex (string $table, string $name, string $newname, string $type, array $fields) | |
alterReference (string $name, string $newname, string $table, array $fields, string $foreign_table, array $foreign_fields, $update, $delete) | |
dropUnique (string $table, string $name) | |
flushStack () | |
Public Member Functions inherited from InterfaceSchema | |
db_get_tables () | |
db_get_columns (string $table) | |
db_get_keys (string $table) | |
db_get_indexes (string $table) | |
db_get_references (string $table) | |
db_create_table (string $name, array $fields) | |
db_create_field (string $table, string $name, string $type,?int $len, bool $null, $default) | |
db_create_primary (string $table, string $name, array $fields) | |
db_create_unique (string $table, string $name, array $fields) | |
db_create_index (string $table, string $name, string $type, array $fields) | |
db_create_reference (string $name, string $table, array $fields, string $foreign_table, array $foreign_fields, $update, $delete) | |
db_alter_field (string $table, string $name, string $type,?int $len, bool $null, $default) | |
db_alter_primary (string $table, string $name, string $newname, array $fields) | |
db_alter_unique (string $table, string $name, string $newname, array $fields) | |
db_alter_index (string $table, string $name, string $newname, string $type, array $fields) | |
db_alter_reference (string $name, string $newname, string $table, array $fields, string $foreign_table, array $foreign_fields, $update, $delete) | |
db_drop_unique (string $table, string $name) | |
Database schema abstraction
__construct | ( | protected ConnectionInterface | $con | ) |
Constructs a new instance.
ConnectionInterface | $con | The DB handler |
dbt2udt | ( | string | $type, |
?int & | $len, | ||
& | $default | ||
) |
Database data type to universal data type conversion.
string | $type | Type name |
int | $len | Field length (in/out) |
mixed | $default | Default field value (in/out) |
Implements SchemaInterface.
udt2dbt | ( | string | $type, |
?int & | $len, | ||
& | $default | ||
) |
Universal data type to database data tye conversion.
string | $type | Type name |
integer | $len | Field length (in/out) |
string | $default | Default field value (in/out) |
Implements SchemaInterface.
Referenced by Schema\db_alter_field(), Schema\db_create_field(), and Schema\db_create_table().
getTables | ( | ) |
Returns an array of all table names.
Implements SchemaInterface.
References InterfaceSchema\db_get_tables().
getColumns | ( | string | $table | ) |
Returns an array of columns (name and type) of a given table.
string | $table | Table name |
Implements SchemaInterface.
References InterfaceSchema\db_get_columns().
getKeys | ( | string | $table | ) |
Returns an array of index of a given table.
string | $table | Table name |
Implements SchemaInterface.
References InterfaceSchema\db_get_keys().
getIndexes | ( | string | $table | ) |
Returns an array of indexes of a given table.
string | $table | Table name |
Implements SchemaInterface.
References InterfaceSchema\db_get_indexes().
getReferences | ( | string | $table | ) |
Returns an array of foreign keys of a given table.
string | $table | Table name |
Implements SchemaInterface.
References InterfaceSchema\db_get_references().
createTable | ( | string | $name, |
array | $fields | ||
) |
Creates a table.
string | $name | The name |
array<string,array<string,mixed>> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_create_table().
createField | ( | string | $table, |
string | $name, | ||
string | $type, | ||
?int | $len, | ||
bool | $null, | ||
$default | |||
) |
Creates a field.
string | $table | The table |
string | $name | The name |
string | $type | The type |
int | null | $len | The length |
bool | $null | The null |
mixed | $default | The default value |
Implements SchemaInterface.
References InterfaceSchema\db_create_field().
createPrimary | ( | string | $table, |
string | $name, | ||
array | $fields | ||
) |
Creates a primary key.
string | $table | The table |
string | $name | The name |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_create_primary().
Referenced by Schema\db_alter_primary().
createUnique | ( | string | $table, |
string | $name, | ||
array | $fields | ||
) |
Creates an unique key.
string | $table | The table |
string | $name | The name |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_create_unique().
Referenced by Schema\db_alter_unique().
createIndex | ( | string | $table, |
string | $name, | ||
string | $type, | ||
array | $fields | ||
) |
Creates an index.
string | $table | The table |
string | $name | The name |
string | $type | The type |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_create_index().
Referenced by Schema\db_alter_index().
createReference | ( | string | $name, |
string | $table, | ||
array | $fields, | ||
string | $foreign_table, | ||
array | $foreign_fields, | ||
$update, | |||
$delete | |||
) |
Creates a reference.
string | $name | The name |
string | $table | The table |
array<string> | $fields The fields | |
string | $foreign_table | The foreign table |
array<string> | $foreign_fields The foreign fields | |
string | false | $update | The update |
string | false | $delete | The delete |
Implements SchemaInterface.
References InterfaceSchema\db_create_reference().
Referenced by Schema\db_alter_reference().
alterField | ( | string | $table, |
string | $name, | ||
string | $type, | ||
?int | $len, | ||
bool | $null, | ||
$default | |||
) |
Modify a field
string | $table | The table |
string | $name | The name |
string | $type | The type |
int | null | $len | The length |
bool | $null | The null |
mixed | $default | The default value |
Implements SchemaInterface.
References InterfaceSchema\db_alter_field().
alterPrimary | ( | string | $table, |
string | $name, | ||
string | $newname, | ||
array | $fields | ||
) |
Modify a primary key
string | $table | The table |
string | $name | The name |
string | $newname | The newname |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_alter_primary().
alterUnique | ( | string | $table, |
string | $name, | ||
string | $newname, | ||
array | $fields | ||
) |
Modify a unique key
string | $table | The table |
string | $name | The name |
string | $newname | The newname |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_alter_unique().
alterIndex | ( | string | $table, |
string | $name, | ||
string | $newname, | ||
string | $type, | ||
array | $fields | ||
) |
Modify an index
string | $table | The table |
string | $name | The name |
string | $newname | The newname |
string | $type | The type |
array<string> | $fields The fields |
Implements SchemaInterface.
References InterfaceSchema\db_alter_index().
alterReference | ( | string | $name, |
string | $newname, | ||
string | $table, | ||
array | $fields, | ||
string | $foreign_table, | ||
array | $foreign_fields, | ||
$update, | |||
$delete | |||
) |
Modify a reference (foreign key)
string | $name | The name |
string | $newname | The newname |
string | $table | The table |
array<string> | $fields The fields | |
string | $foreign_table | The foreign table |
array<string> | $foreign_fields The foreign fields | |
string | false | $update | The update |
string | false | $delete | The delete |
Implements SchemaInterface.
References InterfaceSchema\db_alter_reference().
dropUnique | ( | string | $table, |
string | $name | ||
) |
Remove a unique key
string | $table | The table |
string | $name | The name |
Implements SchemaInterface.
References InterfaceSchema\db_drop_unique().
flushStack | ( | ) |
Flush stack
Implements SchemaInterface.