Dotclear  2.29
 All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
AbstractSchema Class Reference
Inheritance diagram for AbstractSchema:
[legend]
Collaboration diagram for AbstractSchema:
[legend]

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)
 

Detailed Description

Database schema abstraction

Constructor & Destructor Documentation

__construct ( protected ConnectionInterface  $con)

Constructs a new instance.

Parameters
ConnectionInterface$conThe DB handler

Member Function Documentation

dbt2udt ( string  $type,
?int &  $len,
$default 
)

Database data type to universal data type conversion.

Parameters
string$typeType name
int$lenField length (in/out)
mixed$defaultDefault field value (in/out)
Returns
string

Implements SchemaInterface.

udt2dbt ( string  $type,
?int &  $len,
$default 
)

Universal data type to database data tye conversion.

Parameters
string$typeType name
integer$lenField length (in/out)
string$defaultDefault field value (in/out)
Returns
string

Implements SchemaInterface.

Referenced by Schema\db_alter_field(), Schema\db_create_field(), and Schema\db_create_table().

Here is the caller graph for this function:

getTables ( )

Returns an array of all table names.

See also
InterfaceSchema::db_get_tables
Returns
array<string>

Implements SchemaInterface.

References InterfaceSchema\db_get_tables().

Here is the call graph for this function:

getColumns ( string  $table)

Returns an array of columns (name and type) of a given table.

See also
InterfaceSchema::db_get_columns
Parameters
string$tableTable name
Returns
array<string, array{type: string, len: int|null, null: bool, default: string}>

Implements SchemaInterface.

References InterfaceSchema\db_get_columns().

Here is the call graph for this function:

getKeys ( string  $table)

Returns an array of index of a given table.

See also
InterfaceSchema::db_get_keys
Parameters
string$tableTable name
Returns
array<array{name: string, primary: bool, unique: bool, cols: array<string>}>

Implements SchemaInterface.

References InterfaceSchema\db_get_keys().

Here is the call graph for this function:

getIndexes ( string  $table)

Returns an array of indexes of a given table.

See also
InterfaceSchema::db_get_index
Parameters
string$tableTable name
Returns
array<array{name: string, type: string, cols: array<string>}>

Implements SchemaInterface.

References InterfaceSchema\db_get_indexes().

Here is the call graph for this function:

getReferences ( string  $table)

Returns an array of foreign keys of a given table.

See also
InterfaceSchema::db_get_references
Parameters
string$tableTable name
Returns
array<array{name: string, c_cols: array<string>, p_table: string, p_cols: array<string>, update: string, delete: string}>

Implements SchemaInterface.

References InterfaceSchema\db_get_references().

Here is the call graph for this function:

createTable ( string  $name,
array  $fields 
)

Creates a table.

Parameters
string$nameThe name
array<string,array<string,mixed>>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_create_table().

Here is the call graph for this function:

createField ( string  $table,
string  $name,
string  $type,
?int  $len,
bool  $null,
  $default 
)

Creates a field.

Parameters
string$tableThe table
string$nameThe name
string$typeThe type
int | null$lenThe length
bool$nullThe null
mixed$defaultThe default value

Implements SchemaInterface.

References InterfaceSchema\db_create_field().

Here is the call graph for this function:

createPrimary ( string  $table,
string  $name,
array  $fields 
)

Creates a primary key.

Parameters
string$tableThe table
string$nameThe name
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_create_primary().

Referenced by Schema\db_alter_primary().

Here is the call graph for this function:

Here is the caller graph for this function:

createUnique ( string  $table,
string  $name,
array  $fields 
)

Creates an unique key.

Parameters
string$tableThe table
string$nameThe name
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_create_unique().

Referenced by Schema\db_alter_unique().

Here is the call graph for this function:

Here is the caller graph for this function:

createIndex ( string  $table,
string  $name,
string  $type,
array  $fields 
)

Creates an index.

Parameters
string$tableThe table
string$nameThe name
string$typeThe type
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_create_index().

Referenced by Schema\db_alter_index().

Here is the call graph for this function:

Here is the caller graph for this function:

createReference ( string  $name,
string  $table,
array  $fields,
string  $foreign_table,
array  $foreign_fields,
  $update,
  $delete 
)

Creates a reference.

Parameters
string$nameThe name
string$tableThe table
array<string>$fields The fields
string$foreign_tableThe foreign table
array<string>$foreign_fields The foreign fields
string | false$updateThe update
string | false$deleteThe delete

Implements SchemaInterface.

References InterfaceSchema\db_create_reference().

Referenced by Schema\db_alter_reference().

Here is the call graph for this function:

Here is the caller graph for this function:

alterField ( string  $table,
string  $name,
string  $type,
?int  $len,
bool  $null,
  $default 
)

Modify a field

Parameters
string$tableThe table
string$nameThe name
string$typeThe type
int | null$lenThe length
bool$nullThe null
mixed$defaultThe default value

Implements SchemaInterface.

References InterfaceSchema\db_alter_field().

Here is the call graph for this function:

alterPrimary ( string  $table,
string  $name,
string  $newname,
array  $fields 
)

Modify a primary key

Parameters
string$tableThe table
string$nameThe name
string$newnameThe newname
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_alter_primary().

Here is the call graph for this function:

alterUnique ( string  $table,
string  $name,
string  $newname,
array  $fields 
)

Modify a unique key

Parameters
string$tableThe table
string$nameThe name
string$newnameThe newname
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_alter_unique().

Here is the call graph for this function:

alterIndex ( string  $table,
string  $name,
string  $newname,
string  $type,
array  $fields 
)

Modify an index

Parameters
string$tableThe table
string$nameThe name
string$newnameThe newname
string$typeThe type
array<string>$fields The fields

Implements SchemaInterface.

References InterfaceSchema\db_alter_index().

Here is the call graph for this function:

alterReference ( string  $name,
string  $newname,
string  $table,
array  $fields,
string  $foreign_table,
array  $foreign_fields,
  $update,
  $delete 
)

Modify a reference (foreign key)

Parameters
string$nameThe name
string$newnameThe newname
string$tableThe table
array<string>$fields The fields
string$foreign_tableThe foreign table
array<string>$foreign_fields The foreign fields
string | false$updateThe update
string | false$deleteThe delete

Implements SchemaInterface.

References InterfaceSchema\db_alter_reference().

Here is the call graph for this function:

dropUnique ( string  $table,
string  $name 
)

Remove a unique key

Parameters
string$tableThe table
string$nameThe name

Implements SchemaInterface.

References InterfaceSchema\db_drop_unique().

Here is the call graph for this function:

flushStack ( )

Flush stack

Implements SchemaInterface.


The documentation for this class was generated from the following file: