class mssql extends doctrine

deprecated 4.0.0-a1

Database Tools for handling cross-db actions such as altering columns, etc.

Currently not supported is returning SQL for creating tables.

Methods

__construct(Connection $connection, bool $return_statements = false)

Database tools constructors.

from  doctrine
AbstractSchemaManager
get_schema_manager()

No description

from  doctrine
Schema
get_schema()

No description

from  doctrine
array
sql_list_tables()

Gets a list of tables in the database.

from  doctrine
bool
sql_table_exists(string $table_name)

Check if table exists

from  doctrine
array
sql_list_columns(string $table_name)

Gets a list of columns of a table.

from  doctrine
bool
sql_column_exists(string $table_name, string $column_name)

Check whether a specified column exist in a table

from  doctrine
array
sql_list_index(string $table_name)

List all of the indices that belong to a table

from  doctrine
bool
sql_index_exists(string $table_name, string $index_name)

Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.

from  doctrine
bool|string[]
sql_unique_index_exists(string $table_name, string $index_name)

Check if a specified index exists in table.

from  doctrine
bool|string[]
perform_schema_changes(array $schema_changes)

Handle passed database update array.

from  doctrine
bool|string[]
sql_create_table(string $table_name, array $table_data)

Create SQL Table

from  doctrine
bool|string[]
sql_table_drop(string $table_name)

Drop Table

from  doctrine
bool|string[]
sql_column_add(string $table_name, string $column_name, array $column_data)

Add new column

from  doctrine
bool|string[]
sql_column_change(string $table_name, string $column_name, array $column_data)

Change column type (not name!)

from  doctrine
bool|string[]
sql_column_remove(string $table_name, string $column_name)

Drop column

from  doctrine
bool|string[]
sql_create_index(string $table_name, string $index_name, string|array $column)

Add index

from  doctrine
bool|string[]
sql_index_drop(string $table_name, string $index_name)

Drop Index

from  doctrine
bool|string[]
sql_create_unique_index(string $table_name, string $index_name, string|array $column)

Add unique index

from  doctrine
bool|string[]
sql_create_primary_key(string $table_name, string|array $column)

Add primary key

from  doctrine
array
get_filtered_index_list(string $table_name, bool $is_non_unique)

Returns an array of indices for either unique and primary keys, or simple indices.

from  doctrine
array
get_asset_names(array $assets)

Returns an array of lowercase asset names.

from  doctrine
bool
asset_exists(string $needle, array $assets)

Returns whether an asset name exists in a list of assets (case insensitive).

from  doctrine
bool|string[]
alter_schema(callable $callback)

Alter the current database representation using a callback and execute the changes.

from  doctrine
void
alter_table(Schema $schema, string $table_name, callable $callback)

Alter table.

from  doctrine
void
schema_perform_changes(Schema $schema, array $schema_changes)

Perform schema changes

from  doctrine
void
schema_create_table(Schema $schema, string $table_name, array $table_data, bool $safe_check = false)

Update the schema representation with a new table.

from  doctrine
void
schema_drop_table(Schema $schema, string $table_name, bool $safe_check = false)

No description

from  doctrine
void
schema_column_add(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

from  doctrine
void
schema_column_change(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

from  doctrine
void
schema_column_change_add(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

from  doctrine
void
schema_column_remove(Schema $schema, string $table_name, string $column_name, bool $safe_check = false)

No description

from  doctrine
void
schema_create_index($column, Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

from  doctrine
void
schema_create_unique_index($column, Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

from  doctrine
void
schema_index_drop(Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

from  doctrine
void
schema_create_primary_key(Schema $schema, $column, string $table_name, bool $safe_check = false)

No description

from  doctrine
void
recreate_index(Table $table, Index $index, array $new_columns)

Recreate an index of a table

from  doctrine

Details

in doctrine at line 58
__construct(Connection $connection, bool $return_statements = false)

Database tools constructors.

Parameters

Connection $connection
bool $return_statements

in doctrine at line 69
protected AbstractSchemaManager get_schema_manager()

No description

Return Value

AbstractSchemaManager

Exceptions

Exception

in doctrine at line 84
protected Schema get_schema()

No description

Return Value

Schema

Exceptions

Exception

in doctrine at line 92
array sql_list_tables()

Gets a list of tables in the database.

Return Value

array

Array of table names (all lower case)

in doctrine at line 108
bool sql_table_exists(string $table_name)

Check if table exists

Parameters

string $table_name

The table name to check for

Return Value

bool

True if table exists, else false

in doctrine at line 123
array sql_list_columns(string $table_name)

Gets a list of columns of a table.

Parameters

string $table_name

Table name

Return Value

array

Array of column names (all lower case)

in doctrine at line 138
bool sql_column_exists(string $table_name, string $column_name)

Check whether a specified column exist in a table

Parameters

string $table_name

Table to check

string $column_name

Column to check

Return Value

bool

True if column exists, false otherwise

in doctrine at line 153
array sql_list_index(string $table_name)

List all of the indices that belong to a table

NOTE: does not list

  • UNIQUE indices
  • PRIMARY keys

Parameters

string $table_name

Table to check

Return Value

array

Array with index names

in doctrine at line 161
bool sql_index_exists(string $table_name, string $index_name)

Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.

Parameters

string $table_name

Table to check the index at

string $index_name

The index name to check

Return Value

bool

True if index exists, else false

in doctrine at line 169
bool|string[] sql_unique_index_exists(string $table_name, string $index_name)

Check if a specified index exists in table.

NOTE: Does not return normal and PRIMARY KEY indexes

Parameters

string $table_name

Table to check the index at

string $index_name

The index name to check

Return Value

bool|string[]

True if index exists, else false

in doctrine at line 177
bool|string[] perform_schema_changes(array $schema_changes)

Handle passed database update array.

Expected structure... Key being one of the following drop_tables: Drop tables add_tables: Add tables change_columns: Column changes (only type, not name) add_columns: Add columns to a table drop_keys: Dropping keys drop_columns: Removing/Dropping columns add_primary_keys: adding primary keys add_unique_index: adding an unique index add_index: adding an index (can be column:index_size if you need to provide size)

The values are in this format: {TABLE NAME} => array( {COLUMN NAME} => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}), {KEY/INDEX NAME} => array({COLUMN NAMES}), )

Parameters

array $schema_changes

Return Value

bool|string[]

in doctrine at line 195
bool|string[] sql_create_table(string $table_name, array $table_data)

Create SQL Table

Parameters

string $table_name

The table name to create

array $table_data

Array containing table data.

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 208
bool|string[] sql_table_drop(string $table_name)

Drop Table

Parameters

string $table_name

The table name to drop

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 221
bool|string[] sql_column_add(string $table_name, string $column_name, array $column_data)

Add new column

Parameters

string $table_name

Table to modify

string $column_name

Name of the column to add

array $column_data

Column data

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 234
bool|string[] sql_column_change(string $table_name, string $column_name, array $column_data)

Change column type (not name!)

Parameters

string $table_name

Table to modify

string $column_name

Name of the column to modify

array $column_data

Column data

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 280
bool|string[] sql_column_remove(string $table_name, string $column_name)

Drop column

Parameters

string $table_name

Table to modify

string $column_name

Name of the column to drop

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 317
bool|string[] sql_create_index(string $table_name, string $index_name, string|array $column)

Add index

Parameters

string $table_name

Table to modify

string $index_name

Name of the index to create

string|array $column

Either a string with a column name, or an array with columns

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 330
bool|string[] sql_index_drop(string $table_name, string $index_name)

Drop Index

Parameters

string $table_name

Table to modify

string $index_name

Name of the index to delete

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 343
bool|string[] sql_create_unique_index(string $table_name, string $index_name, string|array $column)

Add unique index

Parameters

string $table_name

Table to modify

string $index_name

Name of the unique index to create

string|array $column

Either a string with a column name, or an array with columns

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 356
bool|string[] sql_create_primary_key(string $table_name, string|array $column)

Add primary key

Parameters

string $table_name

Table to modify

string|array $column

Either a string with a column name, or an array with columns

Return Value

bool|string[]

True if the statements have been executed

in doctrine at line 374
protected array get_filtered_index_list(string $table_name, bool $is_non_unique)

Returns an array of indices for either unique and primary keys, or simple indices.

Parameters

string $table_name

The name of the table.

bool $is_non_unique

Whether to return simple indices or primary and unique ones.

Return Value

array

The filtered index array.

in doctrine at line 406
protected array get_asset_names(array $assets)

Returns an array of lowercase asset names.

Parameters

array $assets

Array of assets.

Return Value

array

An array of lowercase asset names.

in doctrine at line 425
protected bool asset_exists(string $needle, array $assets)

Returns whether an asset name exists in a list of assets (case insensitive).

Parameters

string $needle

The asset name to search for.

array $assets

The array of assets.

Return Value

bool

Whether the asset name exists in a list of assets.

in doctrine at line 438
protected bool|string[] alter_schema(callable $callback)

Alter the current database representation using a callback and execute the changes.

Returns false in case of error.

Parameters

callable $callback

Callback taking the schema as parameters and returning it altered (or null in case of error)

Return Value

bool|string[]

in doctrine at line 477
protected void alter_table(Schema $schema, string $table_name, callable $callback)

Alter table.

Parameters

Schema $schema
string $table_name

Table name.

callable $callback

Callback function to modify the table.

Return Value

void

Exceptions

SchemaException

in doctrine at line 489
protected void schema_perform_changes(Schema $schema, array $schema_changes)

Perform schema changes

Parameters

Schema $schema
array $schema_changes

Return Value

void

in doctrine at line 583
protected void schema_create_table(Schema $schema, string $table_name, array $table_data, bool $safe_check = false)

Update the schema representation with a new table.

Returns null in case of errors

Parameters

Schema $schema
string $table_name
array $table_data
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 654
protected void schema_drop_table(Schema $schema, string $table_name, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 673
protected void schema_column_add(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
string $column_name
array $column_data
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 703
protected void schema_column_change(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
string $column_name
array $column_data
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 733
protected void schema_column_change_add(Schema $schema, string $table_name, string $column_name, array $column_data, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
string $column_name
array $column_data
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 754
protected void schema_column_remove(Schema $schema, string $table_name, string $column_name, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
string $column_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 807
protected void schema_create_index($column, Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

Parameters

$column
Schema $schema
string $table_name
string $index_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 829
protected void schema_create_unique_index($column, Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

Parameters

$column
Schema $schema
string $table_name
string $index_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 850
protected void schema_index_drop(Schema $schema, string $table_name, string $index_name, bool $safe_check = false)

No description

Parameters

Schema $schema
string $table_name
string $index_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 870
protected void schema_create_primary_key(Schema $schema, $column, string $table_name, bool $safe_check = false)

No description

Parameters

Schema $schema
$column
string $table_name
bool $safe_check

Return Value

void

Exceptions

SchemaException

in doctrine at line 887
protected void recreate_index(Table $table, Index $index, array $new_columns)

Recreate an index of a table

Parameters

Table $table
Index $index
array $new_columns

Return Value

void

Exceptions

SchemaException