Documentation

SQLAnywhereSchemaManager extends AbstractSchemaManager
in package

SAP Sybase SQL Anywhere schema manager.

Tags
author

Steve Müller st.mueller@dzh-online.de

link
www.doctrine-project.org
since
2.5

Table of Contents

$_conn  : Connection
Holds instance of the Doctrine connection for this schema manager.
$_platform  : AbstractPlatform
Holds instance of the database platform used for this schema manager.
__construct()  : mixed
Constructor. Accepts the Connection instance to manage the schema for.
alterTable()  : void
Alters an existing tables schema.
createConstraint()  : void
Creates a constraint on a table.
createDatabase()  : void
Creates a new database.
createForeignKey()  : void
Creates a new foreign key.
createIndex()  : void
Creates a new index on a table.
createSchema()  : Schema
Creates a schema instance for the current database.
createSchemaConfig()  : SchemaConfig
Creates the configuration for this schema.
createSequence()  : void
Creates a new sequence.
createTable()  : void
Creates a new table.
createView()  : void
Creates a new view.
dropAndCreateConstraint()  : void
Drops and creates a constraint.
dropAndCreateDatabase()  : void
Drops and creates a new database.
dropAndCreateForeignKey()  : void
Drops and creates a new foreign key.
dropAndCreateIndex()  : void
Drops and creates a new index on a table.
dropAndCreateSequence()  : void
Drops and create a new sequence.
dropAndCreateTable()  : void
Drops and creates a new table.
dropAndCreateView()  : void
Drops and creates a new view.
dropConstraint()  : void
Drops the constraint from the given table.
dropDatabase()  : void
Drops a database.
dropForeignKey()  : void
Drops a foreign key from a table.
dropIndex()  : void
Drops the index from the given table.
dropSequence()  : void
Drops a sequence with a given name.
dropTable()  : void
Drops the given table.
dropView()  : void
Drops a view.
extractDoctrineTypeFromComment()  : string
Given a table comment this method tries to extract a typehint for Doctrine Type, or returns the type given as default.
getDatabasePlatform()  : AbstractPlatform
Returns the associated platform.
getSchemaSearchPaths()  : array<string|int, mixed>
The search path for namespaces in the currently connected database.
listDatabases()  : array<string|int, mixed>
Lists the available databases for this connection.
listNamespaceNames()  : array<string|int, mixed>
Returns a list of all namespaces in the current database.
listSequences()  : array<string|int, Sequence>
Lists the available sequences for this connection.
listTableColumns()  : array<string|int, Column>
Lists the columns for a given table.
listTableDetails()  : Table
listTableForeignKeys()  : array<string|int, ForeignKeyConstraint>
Lists the foreign keys for the given table.
listTableIndexes()  : array<string|int, Index>
Lists the indexes for a given table returning an array of Index instances.
listTableNames()  : array<string|int, mixed>
Returns a list of all tables in the current database.
listTables()  : array<string|int, Table>
Lists the tables for this connection.
listViews()  : array<string|int, View>
Lists the views this connection has.
removeDoctrineTypeFromComment()  : string
renameTable()  : void
Renames a given table to another name.
startDatabase()  : mixed
Starts a database.
stopDatabase()  : mixed
Stops a database.
tablesExist()  : bool
Returns true if all the given tables exist.
tryMethod()  : mixed
Tries any method on the schema manager. Normally a method throws an exception when your DBMS doesn't support it or if an error occurs.
_execSql()  : void
_getPortableDatabaseDefinition()  : mixed
_getPortableDatabasesList()  : array<string|int, mixed>
_getPortableFunctionDefinition()  : mixed
_getPortableFunctionsList()  : array<string|int, mixed>
_getPortableSequenceDefinition()  : Sequence
_getPortableSequencesList()  : array<string|int, mixed>
_getPortableTableColumnDefinition()  : Column
Gets Table Column Definition.
_getPortableTableColumnList()  : array<string|int, mixed>
Independent of the database the keys of the column list result are lowercased.
_getPortableTableDefinition()  : array<string|int, mixed>
_getPortableTableForeignKeyDefinition()  : mixed
_getPortableTableForeignKeysList()  : array<string|int, mixed>
_getPortableTableIndexesList()  : array<string|int, mixed>
Aggregates and groups the index results according to the required data result.
_getPortableTablesList()  : array<string|int, mixed>
_getPortableTriggerDefinition()  : mixed
_getPortableTriggersList()  : array<string|int, mixed>
_getPortableUserDefinition()  : mixed
_getPortableUsersList()  : array<string|int, mixed>
_getPortableViewDefinition()  : mixed
_getPortableViewsList()  : array<string|int, mixed>
filterAssetNames()  : array<string|int, mixed>
Filters asset names if they are configured to return only a subset of all the found elements.
getFilterSchemaAssetsExpression()  : string|null
getPortableNamespaceDefinition()  : mixed
Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
getPortableNamespacesList()  : array<string|int, mixed>
Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.

Properties

Methods

createDatabase()

Creates a new database.

public createDatabase(mixed $database) : void

Starts a database after creation as SQL Anywhere needs a database to be started before it can be used.

Parameters
$database : mixed

The name of the database to create.

Tags
see
startDatabase
Return values
void

createIndex()

Creates a new index on a table.

public createIndex(Index $index, Table|string $table) : void
Parameters
$index : Index
$table : Table|string

The name of the table on which the index is to be created.

Return values
void

dropAndCreateConstraint()

Drops and creates a constraint.

public dropAndCreateConstraint(Constraint $constraint, Table|string $table) : void
Parameters
$constraint : Constraint
$table : Table|string
Tags
see
dropConstraint()
see
createConstraint()
Return values
void

dropAndCreateDatabase()

Drops and creates a new database.

public dropAndCreateDatabase(string $database) : void
Parameters
$database : string

The name of the database to create.

Return values
void

dropAndCreateForeignKey()

Drops and creates a new foreign key.

public dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, Table|string $table) : void
Parameters
$foreignKey : ForeignKeyConstraint

An associative array that defines properties of the foreign key to be created.

$table : Table|string

The name of the table on which the foreign key is to be created.

Return values
void

dropAndCreateIndex()

Drops and creates a new index on a table.

public dropAndCreateIndex(Index $index, Table|string $table) : void
Parameters
$index : Index
$table : Table|string

The name of the table on which the index is to be created.

Return values
void

dropAndCreateTable()

Drops and creates a new table.

public dropAndCreateTable(Table $table) : void
Parameters
$table : Table
Return values
void

dropAndCreateView()

Drops and creates a new view.

public dropAndCreateView(View $view) : void
Parameters
$view : View
Return values
void

dropDatabase()

Drops a database.

public dropDatabase(mixed $database) : void

Tries stopping a database before dropping as SQL Anywhere needs a database to be stopped before it can be dropped.

Parameters
$database : mixed

The name of the database to drop.

Tags
see
stopDatabase
Return values
void

dropIndex()

Drops the index from the given table.

public dropIndex(Index|string $index, Table|string $table) : void
Parameters
$index : Index|string

The name of the index.

$table : Table|string

The name of the table.

Return values
void

dropSequence()

Drops a sequence with a given name.

public dropSequence(string $name) : void
Parameters
$name : string

The name of the sequence to drop.

Return values
void

dropTable()

Drops the given table.

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

The name of the table to drop.

Return values
void

dropView()

Drops a view.

public dropView(string $name) : void
Parameters
$name : string

The name of the view.

Return values
void

extractDoctrineTypeFromComment()

Given a table comment this method tries to extract a typehint for Doctrine Type, or returns the type given as default.

public extractDoctrineTypeFromComment(string $comment, string $currentType) : string
Parameters
$comment : string
$currentType : string
Return values
string

getSchemaSearchPaths()

The search path for namespaces in the currently connected database.

public getSchemaSearchPaths() : array<string|int, mixed>

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.

Return values
array<string|int, mixed>

listDatabases()

Lists the available databases for this connection.

public listDatabases() : array<string|int, mixed>
Return values
array<string|int, mixed>

listNamespaceNames()

Returns a list of all namespaces in the current database.

public listNamespaceNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

listSequences()

Lists the available sequences for this connection.

public listSequences([string|null $database = null ]) : array<string|int, Sequence>
Parameters
$database : string|null = null
Return values
array<string|int, Sequence>

listTableColumns()

Lists the columns for a given table.

public listTableColumns(string $table[, string|null $database = null ]) : array<string|int, Column>

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 listTableIndexes($tableName) to retrieve the primary key of a table. We're a RDBMS specifies more details these are held in the platformDetails array.

Parameters
$table : string

The name of the table.

$database : string|null = null
Return values
array<string|int, Column>

listTableForeignKeys()

Lists the foreign keys for the given table.

public listTableForeignKeys(string $table[, string|null $database = null ]) : array<string|int, ForeignKeyConstraint>
Parameters
$table : string

The name of the table.

$database : string|null = null
Return values
array<string|int, ForeignKeyConstraint>

listTableIndexes()

Lists the indexes for a given table returning an array of Index instances.

public listTableIndexes(string $table) : array<string|int, Index>

Keys of the portable indexes list are all lower-cased.

Parameters
$table : string

The name of the table.

Return values
array<string|int, Index>

listTableNames()

Returns a list of all tables in the current database.

public listTableNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

listViews()

Lists the views this connection has.

public listViews() : array<string|int, View>
Return values
array<string|int, View>

removeDoctrineTypeFromComment()

public removeDoctrineTypeFromComment(string $comment, string $type) : string
Parameters
$comment : string
$type : string
Return values
string

renameTable()

Renames a given table to another name.

public renameTable(string $name, string $newName) : void
Parameters
$name : string

The current name of the table.

$newName : string

The new name of the table.

Return values
void

startDatabase()

Starts a database.

public startDatabase(string $database) : mixed
Parameters
$database : string

The name of the database to start.

Return values
mixed

stopDatabase()

Stops a database.

public stopDatabase(string $database) : mixed
Parameters
$database : string

The name of the database to stop.

Return values
mixed

tablesExist()

Returns true if all the given tables exist.

public tablesExist(array<string|int, mixed> $tableNames) : bool
Parameters
$tableNames : array<string|int, mixed>
Return values
bool

tryMethod()

Tries any method on the schema manager. Normally a method throws an exception when your DBMS doesn't support it or if an error occurs.

public tryMethod() : mixed

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');
Return values
mixed

_execSql()

protected _execSql(array<string|int, mixed>|string $sql) : void
Parameters
$sql : array<string|int, mixed>|string
Return values
void

_getPortableDatabaseDefinition()

protected _getPortableDatabaseDefinition(mixed $database) : mixed
Parameters
$database : mixed
Return values
mixed

_getPortableDatabasesList()

protected _getPortableDatabasesList(array<string|int, mixed> $databases) : array<string|int, mixed>
Parameters
$databases : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableFunctionDefinition()

protected _getPortableFunctionDefinition(array<string|int, mixed> $function) : mixed
Parameters
$function : array<string|int, mixed>
Return values
mixed

_getPortableFunctionsList()

protected _getPortableFunctionsList(array<string|int, mixed> $functions) : array<string|int, mixed>
Parameters
$functions : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableSequencesList()

protected _getPortableSequencesList(array<string|int, mixed> $sequences) : array<string|int, mixed>
Parameters
$sequences : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableTableColumnDefinition()

Gets Table Column Definition.

protected _getPortableTableColumnDefinition(mixed $tableColumn) : Column
Parameters
$tableColumn : mixed
Return values
Column

_getPortableTableColumnList()

Independent of the database the keys of the column list result are lowercased.

protected _getPortableTableColumnList(string $table, string $database, array<string|int, mixed> $tableColumns) : array<string|int, mixed>

The name of the created column instance however is kept in its case.

Parameters
$table : string

The name of the table.

$database : string
$tableColumns : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableTableDefinition()

protected _getPortableTableDefinition(mixed $table) : array<string|int, mixed>
Parameters
$table : mixed
Return values
array<string|int, mixed>

_getPortableTableForeignKeyDefinition()

protected _getPortableTableForeignKeyDefinition(mixed $tableForeignKey) : mixed
Parameters
$tableForeignKey : mixed
Return values
mixed

_getPortableTableForeignKeysList()

protected _getPortableTableForeignKeysList(mixed $tableForeignKeys) : array<string|int, mixed>
Parameters
$tableForeignKeys : mixed
Return values
array<string|int, mixed>

_getPortableTableIndexesList()

Aggregates and groups the index results according to the required data result.

protected _getPortableTableIndexesList(mixed $tableIndexRows[, mixed $tableName = null ]) : array<string|int, mixed>
Parameters
$tableIndexRows : mixed
$tableName : mixed = null
Return values
array<string|int, mixed>

_getPortableTablesList()

protected _getPortableTablesList(array<string|int, mixed> $tables) : array<string|int, mixed>
Parameters
$tables : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableTriggerDefinition()

protected _getPortableTriggerDefinition(array<string|int, mixed> $trigger) : mixed
Parameters
$trigger : array<string|int, mixed>
Return values
mixed

_getPortableTriggersList()

protected _getPortableTriggersList(array<string|int, mixed> $triggers) : array<string|int, mixed>
Parameters
$triggers : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableUserDefinition()

protected _getPortableUserDefinition(array<string|int, mixed> $user) : mixed
Parameters
$user : array<string|int, mixed>
Return values
mixed

_getPortableUsersList()

protected _getPortableUsersList(array<string|int, mixed> $users) : array<string|int, mixed>
Parameters
$users : array<string|int, mixed>
Return values
array<string|int, mixed>

_getPortableViewDefinition()

protected _getPortableViewDefinition(mixed $view) : mixed
Parameters
$view : mixed
Return values
mixed

_getPortableViewsList()

protected _getPortableViewsList(array<string|int, mixed> $views) : array<string|int, mixed>
Parameters
$views : array<string|int, mixed>
Return values
array<string|int, mixed>

filterAssetNames()

Filters asset names if they are configured to return only a subset of all the found elements.

protected filterAssetNames(array<string|int, mixed> $assetNames) : array<string|int, mixed>
Parameters
$assetNames : array<string|int, mixed>
Return values
array<string|int, mixed>

getFilterSchemaAssetsExpression()

protected getFilterSchemaAssetsExpression() : string|null
Return values
string|null

getPortableNamespaceDefinition()

Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.

protected getPortableNamespaceDefinition(array<string|int, mixed> $namespace) : mixed
Parameters
$namespace : array<string|int, mixed>

The native DBMS namespace definition.

Return values
mixed

getPortableNamespacesList()

Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.

protected getPortableNamespacesList(array<string|int, mixed> $namespaces) : array<string|int, mixed>
Parameters
$namespaces : array<string|int, mixed>

The list of namespace names in the native DBMS data definition.

Return values
array<string|int, mixed>

Search results