Project Wonder 5.0.0.8794

er.extensions.jdbc
Class ERXSQLHelper.OracleSQLHelper

java.lang.Object
  extended by er.extensions.jdbc.ERXSQLHelper
      extended by er.extensions.jdbc.ERXSQLHelper.OracleSQLHelper
Direct Known Subclasses:
ERXSQLHelper.EROracleSQLHelper
Enclosing class:
ERXSQLHelper

public static class ERXSQLHelper.OracleSQLHelper
extends ERXSQLHelper


Nested Class Summary
 
Nested classes/interfaces inherited from class er.extensions.jdbc.ERXSQLHelper
ERXSQLHelper.ColumnIndex, ERXSQLHelper.CustomTypes, ERXSQLHelper.DerbySQLHelper, ERXSQLHelper.EROracleSQLHelper, ERXSQLHelper.FrontBaseSQLHelper, ERXSQLHelper.MicrosoftSQLHelper, ERXSQLHelper.MySQLSQLHelper, ERXSQLHelper.OpenBaseSQLHelper, ERXSQLHelper.OracleSQLHelper, ERXSQLHelper.PostgresqlSQLHelper
 
Field Summary
 
Fields inherited from class er.extensions.jdbc.ERXSQLHelper
log
 
Constructor Summary
ERXSQLHelper.OracleSQLHelper()
           
 
Method Summary
protected  char commandSeparatorChar()
          This is totally cheating ...
protected  String commandSeparatorString()
           
 String createIndexSQLForEntities(NSArray<EOEntity> entities, NSArray<String> externalTypesToIgnore)
           
 String createSchemaSQLForEntitiesInModelWithNameAndOptions(NSArray<EOEntity> entities, String modelName, NSDictionary optionsCreate)
          oracle 9 has a maximum length of 30 characters for table names, column names and constraint names Foreign key constraint names are defined like this from the plugin:

TABLENAME_FOEREIGNKEYNAME_FK

The whole statement looks like this:

ALTER TABLE [TABLENAME] ADD CONSTRAINT [CONSTRAINTNAME] FOREIGN KEY ([FK]) REFERENCES [DESTINATION_TABLE] ([PK]) DEFERRABLE INITIALLY DEFERRED THIS means that the tablename and the columnname together cannot be longer than 26 characters.

This method checks each foreign key constraint name and if it is longer than 30 characters its replaced with a unique name.
 String externalTypeForJDBCType(JDBCAdaptor adaptor, int jdbcType)
          JDBCAdaptor.externalTypeForJDBCType just returns the first type it finds instead of trying to find a best match.
 String limitExpressionForSQL(EOSQLExpression expression, EOFetchSpecification fetchSpecification, String sql, long start, long end)
           
 String migrationTableName()
          Returns the name of the table to use for database migrations.
 boolean reassignExternalTypeForValueTypeOverride(EOAttribute attribute)
           
 String sqlForCreateIndex(String indexName, String tableName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Returns the SQL expression for creating an index on the given set of columns
 String sqlForCreateUniqueIndex(String indexName, String tableName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Returns the SQL expression for creating a unique index on the given set of columns
protected  String sqlForGetNextValFromSequencedNamed(String sequenceName)
          Returns the SQL required to select the next value from the given sequence.
 String sqlForRegularExpressionQuery(String key, String value)
          Returns the SQL expression for a regular expression query.
 
Methods inherited from class er.extensions.jdbc.ERXSQLHelper
_groupByOrHavingIndex, _orderByIndex, addGroupByClauseToExpression, addGroupByClauseToExpression, addHavingCountClauseToExpression, appendItemToListString, attributesToFetchForEntity, columnIndexesFromColumnNames, columnNamesFromColumnIndexes, commentPattern, createDependentSchemaSQLForEntities, createIndexSQLForEntities, createSchemaSQLForEntitiesInDatabaseContext, createSchemaSQLForEntitiesInModel, createSchemaSQLForEntitiesInModelAndOptions, createSchemaSQLForEntitiesInModelWithName, createSchemaSQLForEntitiesWithOptions, createSchemaSQLForEntitiesWithOptions, customQueryExpressionHintAsString, defaultOptionDictionary, formatValueForAttribute, getNextValFromSequenceNamed, jdbcTypeForCustomType, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, prepareConnectionForSchemaChange, readFormatForAggregateFunction, removeSelectFromExpression, restoreConnectionSettingsAfterSchemaChange, rowCountForFetchSpecification, shouldExecute, splitSQLStatements, splitSQLStatementsFromFile, splitSQLStatementsFromInputStream, sqlExpressionForFetchSpecification, sqlExpressionForFetchSpecification, sqlForCreateIndex, sqlForCreateUniqueIndex, sqlForFullTextQuery, sqlWhereClauseStringForKey, varcharLargeColumnWidth, varcharLargeJDBCType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXSQLHelper.OracleSQLHelper

public ERXSQLHelper.OracleSQLHelper()
Method Detail

sqlForGetNextValFromSequencedNamed

protected String sqlForGetNextValFromSequencedNamed(String sequenceName)
Description copied from class: ERXSQLHelper
Returns the SQL required to select the next value from the given sequence. This should return a single row with a single column.

Overrides:
sqlForGetNextValFromSequencedNamed in class ERXSQLHelper
Parameters:
sequenceName - the name of the sequence
Returns:
the next sequence value

createSchemaSQLForEntitiesInModelWithNameAndOptions

public String createSchemaSQLForEntitiesInModelWithNameAndOptions(NSArray<EOEntity> entities,
                                                                  String modelName,
                                                                  NSDictionary optionsCreate)
oracle 9 has a maximum length of 30 characters for table names, column names and constraint names Foreign key constraint names are defined like this from the plugin:

TABLENAME_FOEREIGNKEYNAME_FK

The whole statement looks like this:

ALTER TABLE [TABLENAME] ADD CONSTRAINT [CONSTRAINTNAME] FOREIGN KEY ([FK]) REFERENCES [DESTINATION_TABLE] ([PK]) DEFERRABLE INITIALLY DEFERRED THIS means that the tablename and the columnname together cannot be longer than 26 characters.

This method checks each foreign key constraint name and if it is longer than 30 characters its replaced with a unique name.

Overrides:
createSchemaSQLForEntitiesInModelWithNameAndOptions in class ERXSQLHelper
Parameters:
entities - a NSArray containing the entities for which create table statements should be generated or null if all entitites in the model should be used.
modelName - the name of the EOModel
Returns:
a String containing SQL statements to create tables
See Also:
createSchemaSQLForEntitiesInModelWithNameAndOptions

limitExpressionForSQL

public String limitExpressionForSQL(EOSQLExpression expression,
                                    EOFetchSpecification fetchSpecification,
                                    String sql,
                                    long start,
                                    long end)
Overrides:
limitExpressionForSQL in class ERXSQLHelper

commandSeparatorChar

protected char commandSeparatorChar()
Description copied from class: ERXSQLHelper
This is totally cheating ... But I just need the separator character for now. We can rewrite the script parser later. Actually, somewhere on earth there is already a sql parser or two. Probably worth getting that one.

Overrides:
commandSeparatorChar in class ERXSQLHelper
Returns:
the separator character used by this database

commandSeparatorString

protected String commandSeparatorString()
Overrides:
commandSeparatorString in class ERXSQLHelper

createIndexSQLForEntities

public String createIndexSQLForEntities(NSArray<EOEntity> entities,
                                        NSArray<String> externalTypesToIgnore)
Overrides:
createIndexSQLForEntities in class ERXSQLHelper

sqlForCreateUniqueIndex

public String sqlForCreateUniqueIndex(String indexName,
                                      String tableName,
                                      ERXSQLHelper.ColumnIndex... columnIndexes)
Description copied from class: ERXSQLHelper
Returns the SQL expression for creating a unique index on the given set of columns

Overrides:
sqlForCreateUniqueIndex in class ERXSQLHelper
Parameters:
indexName - the name of the index to create
tableName - the name of the containing table
columnIndexes - the list of columns to index on
Returns:
a SQL expression

sqlForCreateIndex

public String sqlForCreateIndex(String indexName,
                                String tableName,
                                ERXSQLHelper.ColumnIndex... columnIndexes)
Description copied from class: ERXSQLHelper
Returns the SQL expression for creating an index on the given set of columns

Overrides:
sqlForCreateIndex in class ERXSQLHelper
Parameters:
indexName - the name of the index to create
tableName - the name of the containing table
columnIndexes - the list of columns to index on
Returns:
a SQL expression

sqlForRegularExpressionQuery

public String sqlForRegularExpressionQuery(String key,
                                           String value)
Description copied from class: ERXSQLHelper
Returns the SQL expression for a regular expression query.

Overrides:
sqlForRegularExpressionQuery in class ERXSQLHelper
Returns:
the regex SQL

migrationTableName

public String migrationTableName()
Description copied from class: ERXSQLHelper
Returns the name of the table to use for database migrations.

Overrides:
migrationTableName in class ERXSQLHelper
Returns:
the name of the table to use for database migrations

externalTypeForJDBCType

public String externalTypeForJDBCType(JDBCAdaptor adaptor,
                                      int jdbcType)
Description copied from class: ERXSQLHelper
JDBCAdaptor.externalTypeForJDBCType just returns the first type it finds instead of trying to find a best match. This can still fail, mind you, but it should be much better than the EOF default impl.

Overrides:
externalTypeForJDBCType in class ERXSQLHelper
Parameters:
adaptor - the adaptor to retrieve an external type for
jdbcType - the JDBC type number
Returns:
a guess at the external type name to use

reassignExternalTypeForValueTypeOverride

public boolean reassignExternalTypeForValueTypeOverride(EOAttribute attribute)
Overrides:
reassignExternalTypeForValueTypeOverride in class ERXSQLHelper

Last updated: Thu, Jan 8, 2009 • 12:32 PM EST

Copyright © 2002 – 2007 Project Wonder.