DB2SchemaManager
class DB2SchemaManager extends AbstractSchemaManager (View source)
IBM Db2 Schema Manager
Properties
protected Connection | $_conn | Holds instance of the Doctrine connection for this schema manager | from AbstractSchemaManager |
protected AbstractPlatform | $_platform | Holds instance of the database platform used for this schema manager | from AbstractSchemaManager |
Methods
Try any method on the schema manager. Normally a method throws an exception when your DBMS doesn't support it or if an error occurs.
List the available sequences for this connection
List the columns for a given table.
List the indexes for a given table returning an array of Index instances.
Return true if all the given tables exist.
Return a list of all tables in the current database
Filter asset names if they are configured to return only a subset of all the found elements.
List the foreign keys for the given table
Drops a foreign key from a table.
Drop and create a new foreign key
Rename a given table to another name
Methods for filtering return values of list*() methods to convert the native DBMS data definition to a portable Doctrine definition
Independent of the database the keys of the column list result are lowercased.
Get Table Column Definition
Aggregate and group the index results according to the required data result.
No description
No description
No description
Create the configuration for this schema.
The search path for namespaces in the currently connected database.
Given a table comment this method tries to extract a typehint for Doctrine Type, or returns the type given as default.
No description
Details
in AbstractSchemaManager at line 62
__construct(Connection $conn)
Constructor. Accepts the Connection instance to manage the schema for
in AbstractSchemaManager at line 73
AbstractPlatform
getDatabasePlatform()
Return associated platform.
in AbstractSchemaManager at line 90
mixed
tryMethod()
Try any method on the schema manager. Normally a method throws an exception when your DBMS doesn't support it or if an error occurs.
This method allows you to try and method on your SchemaManager instance and will return false if it does not work or is not supported.
$result = $sm->tryMethod('dropView', 'view_name');
array
listDatabases()
List the available databases for this connection
Sequence[]
listSequences($database = null)
List the available sequences for this connection
Column[]
listTableColumns(string $table, string $database = null)
List the columns for a given table.
In contrast to other libraries and to the old version of Doctrine, this column definition does try to contain the 'primary' field for the reason that it is not portable accross different RDBMS. Use {see listTableIndexes($tableName)} to retrieve the primary key of a table. We're a RDBMS specifies more details these are held in the platformDetails array.
Index[]
listTableIndexes(string $table)
List the indexes for a given table returning an array of Index instances.
Keys of the portable indexes list are all lower-cased.
bool
tablesExist(array $tableNames)
Return true if all the given tables exist.
at line 45
array
listTableNames()
Return a list of all tables in the current database
Apparently creator is the schema not the user who created it: {@link http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.sqlref/db2z_sysibmsystablestable.htm}
protected array
filterAssetNames(array $assetNames)
Filter asset names if they are configured to return only a subset of all the found elements.
protected
getFilterSchemaAssetsExpression()
Table[]
listTables()
List the tables for this connection
Table
listTableDetails(string $tableName)
View[]
listViews()
List the views this connection has
ForeignKeyConstraint[]
listTableForeignKeys($table, $database = null)
List the foreign keys for the given table
dropDatabase(string $database)
Drops a database.
NOTE: You can not drop the database this SchemaManager is currently connected to.
dropTable(string $table)
Drop the given table
dropConstraint(Constraint $constraint, string $table)
Drop the constraint from the given table
boolean
dropForeignKey($foreignKey, $table)
Drops a foreign key from a table.
dropSequence(string $name)
Drops a sequence with a given name.
boolean
dropView(string $name)
Drop a view
createDatabase(string $database)
Creates a new database.
createTable(Table $table)
Create a new table.
createSequence(Sequence $sequence)
Create a new sequence
createConstraint(Constraint $constraint, string|Table $table)
Create a constraint on a table
createIndex(Index $index, string $table)
Create a new index on a table
createForeignKey(ForeignKeyConstraint $foreignKey, string|Table $table)
Create a new foreign key
createView(View $view)
Create a new view
dropAndCreateConstraint(Constraint $constraint, string $table)
Drop and create a constraint
dropAndCreateIndex(Index $index, $table)
Drop and create a new index on a table
dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, string|Table $table)
Drop and create a new foreign key
dropAndCreateSequence(Sequence $sequence)
Drop and create a new sequence
dropAndCreateTable(Table $table)
Drop and create a new table.
dropAndCreateDatabase(string $database)
Drop and creates a new database.
dropAndCreateView(View $view)
Drop and create a new view
alterTable(TableDiff $tableDiff)
Alter an existing tables schema
renameTable(string $name, string $newName)
Rename a given table to another name
protected
_getPortableDatabasesList($databases)
Methods for filtering return values of list*() methods to convert the native DBMS data definition to a portable Doctrine definition
protected
_getPortableDatabaseDefinition($database)
protected
_getPortableFunctionsList($functions)
protected
_getPortableFunctionDefinition($function)
protected
_getPortableTriggersList($triggers)
protected
_getPortableTriggerDefinition($trigger)
protected
_getPortableSequencesList($sequences)
protected Sequence
_getPortableSequenceDefinition(array $sequence)
protected array
_getPortableTableColumnList(string $table, string $database, array $tableColumns)
Independent of the database the keys of the column list result are lowercased.
The name of the created column instance however is kept in its case.
at line 62
protected Column
_getPortableTableColumnDefinition(array $tableColumn)
Get Table Column Definition
at line 123
protected array
_getPortableTableIndexesList($tableIndexes, string $tableName = null)
Aggregate and group the index results according to the required data result.
at line 113
protected
_getPortableTablesList($tables)
protected
_getPortableTableDefinition($table)
protected
_getPortableUsersList($users)
protected
_getPortableUserDefinition($user)
protected
_getPortableViewsList($views)
at line 200
protected
_getPortableViewDefinition($view)
protected
_getPortableTableForeignKeysList($tableForeignKeys)
at line 171
protected
_getPortableTableForeignKeyDefinition($tableForeignKey)
protected
_execSql($sql)
Schema
createSchema()
Create a schema instance for the current database.
SchemaConfig
createSchemaConfig()
Create the configuration for this schema.
array
getSchemaSearchPaths()
The search path for namespaces in the currently connected database.
The first entry is usually the default namespace in the Schema. All further namespaces contain tables/sequences which can also be addressed with a short, not full-qualified name.
For databases that don't support subschema/namespaces this method returns the name of the currently connected database.
string
extractDoctrineTypeFromComment(string $comment, string $currentType)
Given a table comment this method tries to extract a typehint for Doctrine Type, or returns the type given as default.