Package Modeling :: Package DatabaseAdaptors :: Package MySQLAdaptorLayer :: Module MySQLSchemaGeneration :: Class MySQLSchemaGeneration
[show private | hide private]
[frames | no frames]

Class MySQLSchemaGeneration

SchemaGeneration --+
                   |
                  MySQLSchemaGeneration


Implements the details db-schema generation which differ from the standard behaviour implemented by SchemaGeneration.

See also Modeling.SchemaGeneration and Modeling.interfaces.SchemaGeneration for further details


Method Summary
  createDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, createUserFlag)
See also: interfaces.SchemaGeneration for details
  dropDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, dropUserFlag)
See Modeling.interfaces.SchemaGeneration for details
  dropPrimaryKeySupportStatementsForEntityGroup(self, entityGroup)
Returns a list containing a single SQLExpression statement, which takes the following form: 'DROP TABLE <SEQUENCE_NAME>', where '<SEQUENCE_NAME>' is:
  foreignKeyConstraintStatementsForRelationship(self, relationship)
Removes ' INITIALLY DEFERRED' from the statements returned by SQLExpression's foreignKeyConstraintStatementsForRelationship() and returns them.
  primaryKeySupportStatementsForEntityGroup(self, entityGroup)
Returns a list containing two SQLExpression statements, which take the following form:
    Inherited from SchemaGeneration
  __init__(self, anAdaptor)
See interfaces.SchemaGeneration for details
  appendExpressionToScript(self, expression, script)
Appends the expression to the StringIO script, prepended with a semi-colon (';') and a newline if the StringIO is not empty.
  createTableStatementsForEntityGroup(self, entityGroup)
Returns a list of SQLExpressions needed to create the tables defined by the supplied 'entityGroup', or an empty list if 'entityGroup' is empty.
  createTableStatementsForEntityGroups(self, entityGroups)
Invokes createTableStatementsForEntityGroup() for each entityGroup in 'entityGroups', and returns the list of SQLExpressions needed to create the necessary table.
  defaultOrderingsForSchemaCreation()
Used in method SchemaGeneration.schemaCreationScriptForEntities() to order the schema creation statements produced (Static method)
  dropForeignKeyConstraintStatementsForRelationship(self, relationship)
Default implementation returns an empty list.
  dropPrimaryKeyConstraintStatementsForEntityGroup(self, entityGroup)
Default implementation returns an empty list.
  dropPrimaryKeyConstraintStatementsForEntityGroups(self, entityGroups)
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeyConstraintStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence.
  dropPrimaryKeySupportStatementsForEntityGroups(self, entityGroups)
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeySupportStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence.
  dropTableStatementsForEntityGroup(self, entityGroup)
Parameter:
  dropTableStatementsForEntityGroups(self, entityGroups)
Iterates on each entityGroup in 'entityGroups', sends the message 'dropPrimaryKeySupportStatementsForEntityGroup()' to each of them, collects the results and returns them in a sequence.
  primaryKeyConstraintStatementsForEntityGroup(self, entityGroup)
Default implementation returns an empty list.
  primaryKeyConstraintStatementsForEntityGroups(self, entityGroups)
Iterates on each entityGroup in 'entityGroups', sends the message 'primaryKeyConstraintStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence.
  primaryKeySupportStatementsForEntityGroups(self, entityGroups)
Iterates on each entityGroup in 'entityGroups', sends the message 'primaryKeySupportStatementsForEntityGroup' to each of them, collects the results and returns them in a sequence.
  schemaCreationScriptForEntities(self, allEntities, options, keyOrderings)
__TBD
  schemaCreationStatementsForEntities(self, allEntities, options, keyOrderings)
__TBD doc.
  schemaCreationStatementsForEntitiesByOptions(self, allEntities, options)
__TBD doc.
  setDefaultOrderingsForSchemaCreation(keyOrderings)
Sets the default ordering. (Static method)
  tableEntityGroupsForEntities(self, entities)
Returns a list of entityGroups ; each entityGroup consists of the entities in parameter 'entities' which share the same externalName(), and wich answered positively to the definesTableColumns() message.

Class Variable Summary
    Inherited from SchemaGeneration
tuple __implements__ = (<class Modeling.interfaces.SchemaGener...

Instance Method Details

createDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, createUserFlag=0)

See also: interfaces.SchemaGeneration for details
Overrides:
Modeling.SchemaGeneration.SchemaGeneration.createDatabaseStatementsForConnectionDictionary

dropDatabaseStatementsForConnectionDictionary(self, connectionDictionary, administrativeConnectionDictionary, dropUserFlag=0)

See Modeling.interfaces.SchemaGeneration for details
Overrides:
Modeling.SchemaGeneration.SchemaGeneration.dropDatabaseStatementsForConnectionDictionary

dropPrimaryKeySupportStatementsForEntityGroup(self, entityGroup)

Returns a list containing a single SQLExpression statement, which takes the following form: 'DROP TABLE <SEQUENCE_NAME>', where '<SEQUENCE_NAME>' is:

'PK_SEQ_%s'%entityGroup[0].primaryKeyRootName()

See primaryKeySupportStatementsForEntityGroup() for further details on how sequences can be emulated with MySQL databases.

See Modeling.interfaces.SchemaGeneration for further details

Overrides:
Modeling.SchemaGeneration.SchemaGeneration.dropPrimaryKeySupportStatementsForEntityGroup

foreignKeyConstraintStatementsForRelationship(self, relationship)

Removes ' INITIALLY DEFERRED' from the statements returned by SQLExpression's foreignKeyConstraintStatementsForRelationship() and returns them.
Overrides:
Modeling.SchemaGeneration.SchemaGeneration.foreignKeyConstraintStatementsForRelationship

primaryKeySupportStatementsForEntityGroup(self, entityGroup)

Returns a list containing two SQLExpression statements, which take the following form:

CREATE TABLE <SEQUENCE_NAME> (id INT NOT NULL)
INSERT INTO <SEQUENCE_NAME> VALUES(0)

where '<SEQUENCE_NAME>' is:

'PK_SEQ_%s'%entityGroup[0].primaryKeyRootName()

cf. http://www.mysql.com/doc/en/Miscellaneous_functions.html: this is one way to emulate real sequences with MySQL.

The statements used by MySQLAdaptorChannel.primaryKeysForNewRowsWithEntity are the following:

'UPDATE PK_SEQ_%s SET id=LAST_INSERT_ID(id+1)'%pkRootName
'select id FROM PK_SEQ_%s'%pkRootName

See Modeling.interfaces.SchemaGeneration for further details

See also:
dropPrimaryKeySupportStatementsForEntityGroup() MySQLAdaptorChannel.primaryKeysForNewRowsWithEntity()
Overrides:
Modeling.SchemaGeneration.SchemaGeneration.primaryKeySupportStatementsForEntityGroup

Generated by Epydoc 2.1 on Sat Mar 4 13:36:25 2006 http://epydoc.sf.net