|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface has been introduced to define API to synchronize a database schema with a corresponding EOModel. None of the API is new in WebObjects 5.x. Rather, it was moved to EOSchemaSynchronization from EOSQLExpression. The API is essentially the same as in WebObjects 4.5.x except that methods which were formerly static methods of EOSQLExpression in WebObjects 4.5.x are now are instance methods of EOSchemaSynchronization.
An implementation of the EOSchemaSynchronization interface is provided by EOSynchronizationFactory, a new class introduced in WebObjects 5.0.
EOSchemaSynchronization defines a number of constants for use as keys in change dictionaries or options dictionaries. A change dictionary contains information about tables to insert, tables to delete, tables to update, and information about how to update them.
The schema synchronization API is typically used only by the EOModeler application, not by user application code.
EOSQLExpression
,
EOSchemaGeneration
,
EOSynchronizationFactory
Inner Class Summary | |
static interface |
EOSchemaSynchronization.ColumnTypes
The ColumnTypes interface is only used when implementing schema synchronization API for a custom adaptor. |
Field Summary | |
static String |
AllowsNullKey
Key for use in change dictionaries whose value of "YES" or "NO" is
the setting in the database for whether a database column allows
NULL values. |
static String |
ColumnNameKey
Key for use in change dictionaries whose value is the column name in the database for an EOAttribute. |
static String |
ExternalNameKey
Key for use in change dictionaries whose value is the external name (database table name) for an EOEntity. |
static String |
ExternalTypeKey
Key for use in change dictionaries whose value is the external type (database type) for an EOAttribute. |
static String |
NameKey
Key for use in change dictionaries whose value is the name in the database for a property. |
static String |
PrecisionKey
Key for use in change dictionaries whose value is the precision value in the database for an EOAttribute. |
static String |
RelationshipsKey
Key for use in change dictionaries whose value is a dictionary of relationships which have been modified since the last time the model and schema were synchronized. |
static String |
ScaleKey
Key for use in change dictionaries whose value is the scale value in the database for an EOAttribute. |
static String |
SchemaSynchronizationForeignKeyConstraintsKey
Options dictionary key; an associated value of "YES"
determines that the EOSQLExpression should generate SQL to create
foreign key constraints. |
static String |
SchemaSynchronizationPrimaryKeyConstraintsKey
Options dictionary key; an associated value of "YES"
determines that the EOSQLExpression should generate SQL to create
primary key constraints. |
static String |
SchemaSynchronizationPrimaryKeySupportKey
Options dictionary key; an associated value of "YES"
determines that the EOSQLExpression should generate SQL to create
primary key support. |
static String |
WidthKey
Key for use in change dictionaries whose corresponding value is the width value in the database for an EOAttribute. |
Method Summary | |
boolean |
isColumnTypeEquivalentToColumnType(EOSchemaSynchronization.ColumnTypes candidate,
EOSchemaSynchronization.ColumnTypes columnType,
NSDictionary options)
Returns true if the name, precision, width,
and scale of candidate are identical to the name,
precision, width, and scale of columnType ,
false otherwise. |
NSDictionary |
objectStoreChangesFromAttributeToAttribute(EOAttribute schemaAttribute,
EOAttribute modelAttribute)
Compares schemaAttribute with
modelAttribute and returns a change dictionary of
state that is different between the the two. |
String |
phraseCastingColumnNamed(String columnName,
EOSchemaSynchronization.ColumnTypes type,
EOSchemaSynchronization.ColumnTypes castType,
NSDictionary options)
Returns an SQL string to cast the values in the column identified by columnName from the current type to a new
type specified by castType . |
NSArray |
statementsToConvertColumnType(String columnName,
String tableName,
EOSchemaSynchronization.ColumnTypes type,
EOSchemaSynchronization.ColumnTypes newType,
NSDictionary options)
Returns an array of EOSQLExpressions to convert in place of the type of the column indentifed by columnName in the table
identified by tableName from the current
type to the type specified by newType . |
NSArray |
statementsToCopyTableNamed(String tableName,
NSArray entityGroup,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to copy the specified table into a new table, whose definition is provided by entityGroup , an array of EOEntity objects with the
same external name. |
NSArray |
statementsToDeleteColumnNamed(String columnName,
String tableName,
NSDictionary options)
Returns an array of EOSQLExpressions to delete the column indentifed by columnName from the table identified by
tableName . |
NSArray |
statementsToDropForeignKeyConstraintsOnEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to drop foreign key constraints for the table corresponding to entityGroups , which is
an array containing arrays of EOEntity objects with the same
external name. |
NSArray |
statementsToDropPrimaryKeyConstraintsOnEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to drop primary key constraints for the table corresponding to entityGroups , which is
an array containing arrays of EOEntity objects with the same
external name. |
NSArray |
statementsToDropPrimaryKeySupportForEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to drop primary key support for the table corresponding to entityGroups , which is
an array containing arrays of EOEntity objects with the same
external name. |
NSArray |
statementsToImplementForeignKeyConstraintsOnEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to implement foreign key constraints for the table corresponding to entityGroups , which is an array containing arrays of
EOEntity objects with the same external name. |
NSArray |
statementsToImplementPrimaryKeyConstraintsOnEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to implement primary key constraints for the table corresponding to entityGroups , which is an array containing arrays of
EOEntity objects with the same external name. |
NSArray |
statementsToImplementPrimaryKeySupportForEntityGroups(NSArray entityGroups,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to implement primary key support for the table corresponding to entityGroups ,
which is an array containing arrays of EOEntity objects with the
same external name. |
NSArray |
statementsToInsertColumnForAttribute(EOAttribute attribute,
NSDictionary options)
Returns an array of EOSQLExpressions to insert a column in the database schema for the specified attribute . |
NSArray |
statementsToModifyColumnNullRule(String columnName,
String tableName,
boolean allowsNull,
NSDictionary options)
Returns an array of EOSQLExpressions to modify in place the column identified by columnName in the table identified
by tableName to either allow or not allow NULL values
as specified by allowsNull . |
NSArray |
statementsToRenameColumnNamed(String columnName,
String tableName,
String newName,
NSDictionary options)
Returns an array of EOSQLExpressions to rename in place of the the column indentifed by tableName to newName . |
NSArray |
statementsToRenameTableNamed(String tableName,
String newName,
NSDictionary options)
Returns an array of EOSQLExpressions to rename in place the the table indentifed by tableName to
newName . |
NSArray |
statementsToUpdateObjectStoreForEntityGroups(NSArray model,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to update the database table that corresponds to model according to the changes
and SQL generation instructions in the changes and
options dictionaries. |
NSArray |
statementsToUpdateObjectStoreForModel(EOModel model,
NSDictionary changes,
NSDictionary options)
Returns an array of EOSQLExpressions to synchronize the database with the EOModel model . |
boolean |
supportsDirectColumnCoercion()
Returns true if the adaptor can change the type of an
existing column in place, false otherwise. |
boolean |
supportsDirectColumnDeletion()
Returns true if the adaptor can delete columns,
false otherwise. |
boolean |
supportsDirectColumnInsertion()
Returns true if the adaptor can add columns to a table,
false otherwise. |
boolean |
supportsDirectColumnNullRuleModification()
Returns true if the adaptor can modify the
null rule of an existing column in place,
false otherwise. |
boolean |
supportsDirectColumnRenaming()
Returns true if the adaptor can rename table columns,
false otherwise. |
boolean |
supportsSchemaSynchronization()
Returns true if the adaptor can update the database
schema to reflect changes in an EOModel, false
otherwise. |
Field Detail |
public static final String AllowsNullKey
"YES"
or "NO"
is
the setting in the database for whether a database column allows
NULL values.EOAttribute.allowsNull()
public static final String ColumnNameKey
EOAttribute.columnName()
public static final String ExternalNameKey
EOEntity.externalName()
public static final String ExternalTypeKey
EOAttribute.externalType()
public static final String NameKey
EOAttribute.name()
,
EOEntity.name()
,
EORelationship.name()
public static final String PrecisionKey
EOAttribute.precision()
public static final String RelationshipsKey
public static final String ScaleKey
EOAttribute.scale()
public static final String SchemaSynchronizationForeignKeyConstraintsKey
"YES"
determines that the EOSQLExpression should generate SQL to create
foreign key constraints.public static final String SchemaSynchronizationPrimaryKeyConstraintsKey
"YES"
determines that the EOSQLExpression should generate SQL to create
primary key constraints.public static final String SchemaSynchronizationPrimaryKeySupportKey
"YES"
determines that the EOSQLExpression should generate SQL to create
primary key support.public static final String WidthKey
EOAttribute.width()
Method Detail |
public boolean isColumnTypeEquivalentToColumnType(EOSchemaSynchronization.ColumnTypes candidate, EOSchemaSynchronization.ColumnTypes columnType, NSDictionary options)
true
if the name, precision, width,
and scale of candidate
are identical to the name,
precision, width, and scale of columnType
,
false
otherwise. If the columns are equivalent,
the candidate column can be copied to columnType
without casting.candidate
- A column to potentially copy.columnType
- A column into which to copy
candidate
.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.true
if the specified attributes
of candidate
are identical to the
corresponding attributes of
columnType
.public NSDictionary objectStoreChangesFromAttributeToAttribute(EOAttribute schemaAttribute, EOAttribute modelAttribute)
schemaAttribute
with
modelAttribute
and returns a change dictionary of
state that is different between the the two. The possible keys in
the change dictionary are:
ExternalTypeKey
AllowsNullKey
PrecisionKey
ScaleKey
WidthKey
The values in the change dictionary are the corresponding
values of schemaAttribute
, that is, the values stored
in the database.
schemaAttribute
- An EOAttribute as represented in the
database.modelAttribute
- An EOAttribute as represented in the
EOModel.schemaAttribute
and modelAttribute
.public String phraseCastingColumnNamed(String columnName, EOSchemaSynchronization.ColumnTypes type, EOSchemaSynchronization.ColumnTypes castType, NSDictionary options)
columnName
from the current type
to a new
type specified by castType
. This method is used when
the adaptor doesn't support in-place column type coercion, and the
table has to be recreated. To move data from the old table to the
new table, sometimes a conversion statement is needed (for example,
to convert strings in a VARCHAR column to numbers).
options
is a dictionary describing the aspects of the
schema for which to create SQL statements.columnName
- The name of a database column.type
- The type of the values in the specified column.castType
- The new type to which to cast the values in the
specified column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.castType
public NSArray statementsToConvertColumnType(String columnName, String tableName, EOSchemaSynchronization.ColumnTypes type, EOSchemaSynchronization.ColumnTypes newType, NSDictionary options)
columnName
in the table
identified by tableName
from the current
type
to the type specified by newType
.
options
is a dictionary describing the aspects
of the schema for which to create SQL statements.columnName
- The name of a column to be modified.tableName
- The name of the table containing the specified
column.type
- The current type of the specified column.newType
- The type to which to convert the specified column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.public NSArray statementsToCopyTableNamed(String tableName, NSArray entityGroup, NSDictionary changes, NSDictionary options)
entityGroup
, an array of EOEntity objects with the
same external name. This method is used when the
adaptor doesn't support the in-place table modifications required
to synchronize the database to a model.
The changes
dictionary identifies the changes to
make to the database schema. The options
dictionary
describes the aspects of the schema for which to create SQL
statements.
tableName
- The name of the table to be copied.entityGroup
- An array of EOEntity objects that defines a new
database table into which to copy the named
table.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.tableName
to a new table
defined by entityGroup
.EOSchemaSynchronization
public NSArray statementsToDeleteColumnNamed(String columnName, String tableName, NSDictionary options)
columnName
from the table identified by
tableName
. options
is a dictionary
describing the aspects of the schema for which to create
SQL statements.columnName
- The name of a column to be deleted.tableName
- The name of the table containing the specified
column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.public NSArray statementsToDropForeignKeyConstraintsOnEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
, which is
an array containing arrays of EOEntity objects with the same
external name. The changes
dictionary identifies the
changes to make to the database schema. The options
dictionary describes the aspects of the schema for which to create
SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToDropPrimaryKeyConstraintsOnEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
, which is
an array containing arrays of EOEntity objects with the same
external name. The changes
dictionary identifies the
changes to make to the database schema. The options
dictionary describes the aspects of the schema for which to create
SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToDropPrimaryKeySupportForEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
, which is
an array containing arrays of EOEntity objects with the same
external name. The changes
dictionary identifies the
changes to make to the database schema. The options
dictionary describes the aspects of the schema for which to create
SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToImplementForeignKeyConstraintsOnEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
, which is an array containing arrays of
EOEntity objects with the same external name. The
changes
dictionary identifies changes to make to
the database schema. The options
dictionary describes
the aspects of the schema for which to create SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToImplementPrimaryKeyConstraintsOnEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
, which is an array containing arrays of
EOEntity objects with the same external name. The
changes
dictionary identifies the changes to make to
the database schema. The options
dictionary describes
the aspects of the schema for which to create SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToImplementPrimaryKeySupportForEntityGroups(NSArray entityGroups, NSDictionary changes, NSDictionary options)
entityGroups
,
which is an array containing arrays of EOEntity objects with the
same external name. The changes
dictionary identifies
the changes to make to the database schema. The options
dictionary describes the aspects of the schema for which to create
SQL statements.entityGroups
- An array containing arrays of EOEntity objects
with the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the
schema for which to create SQL statements.entityGroups
.EOSchemaSynchronization
public NSArray statementsToInsertColumnForAttribute(EOAttribute attribute, NSDictionary options)
attribute
. The
options
dictionary describes the aspects of the schema
for which to create SQL statements.attribute
- An EOAttribute for which to insert a database
column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.attribute
.EOAttribute
,
EOSchemaSynchronization
public NSArray statementsToModifyColumnNullRule(String columnName, String tableName, boolean allowsNull, NSDictionary options)
columnName
in the table identified
by tableName
to either allow or not allow NULL values
as specified by allowsNull
. The options
dictionary describes the aspects of the schema for which to create
SQL statements.columnName
- The name of a column to be modified.tableName
- The name of the table containing the specified
column.allowsNull
- A boolean value to determine whether to allow or
not allow NULL values in the specified column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.EOSchemaSynchronization
public NSArray statementsToRenameColumnNamed(String columnName, String tableName, String newName, NSDictionary options)
tableName
to newName
.
options
is a dictionary describing the aspects
of the schema for which to create SQL statements.columnName
- The name of a column to be renamed.tableName
- The name of the table containing the specified
column.newName
- The new name for the specified column.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.public NSArray statementsToRenameTableNamed(String tableName, String newName, NSDictionary options)
tableName
to
newName
. options
is a dictionary
describing the aspects of the schema for which to create SQL
statements.tableName
- The name of a table to be renamed.newName
- The new name for the specified table.options
- A dictionary describing the aspects of the schema
for which to create SQL statements.public NSArray statementsToUpdateObjectStoreForEntityGroups(NSArray model, NSDictionary changes, NSDictionary options)
model
according to the changes
and SQL generation instructions in the changes
and
options
dictionaries. model
is an array
of entity groups, which are arrays of EOEntity objects that have
the same external name. Inserts and deletes columns, and updates
modified columns.model
- An array of entity groups, which are arrays of
EOEntity objects that have the same external name.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the schema for
which to create SQL statements.model
.EOSchemaSynchronization
public NSArray statementsToUpdateObjectStoreForModel(EOModel model, NSDictionary changes, NSDictionary options)
model
. Prepares the statements to
insert and delete new and deleted tables before invoking
statementsToUpdateObjectStoreForEntityGroups
for each
modified table. The changes
dictionary identifies the
changes to make to the database schema. The options
dictionary describes the aspects of the schema for which to create
SQL statements.model
- The EOModel with which to sychnronize the database.changes
- A dictionary of changes to make to the database
schema.options
- A dictionary describing the aspects of the schema for
which to create SQL statements.model
.statementsToUpdateObjectStoreForEntityGroups(
NSArray model, NSDictionary changes,
NSDictionary options)
,
EOSchemaSynchronization
public boolean supportsDirectColumnCoercion()
true
if the adaptor can change the type of an
existing column in place, false
otherwise.true
if the adaptor can change the type of
an existing column in place.public boolean supportsDirectColumnDeletion()
true
if the adaptor can delete columns,
false
otherwise.true
if the adaptor can delete columns.public boolean supportsDirectColumnInsertion()
true
if the adaptor can add columns to a table,
false
otherwise.true
if the adaptor can add columns to a table.public boolean supportsDirectColumnNullRuleModification()
true
if the adaptor can modify the
null
rule of an existing column in place,
false
otherwise.true
if the adaptor can modify the
null
rule of an existing column in placepublic boolean supportsDirectColumnRenaming()
true
if the adaptor can rename table columns,
false
otherwise.true
if the adaptor can rename table columns.public boolean supportsSchemaSynchronization()
true
if the adaptor can update the database
schema to reflect changes in an EOModel, false
otherwise.true
if the adaptor can update the database
schema.
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |