Project Wonder 5.0

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.H2SQLHelper, ERXSQLHelper.MicrosoftSQLHelper, ERXSQLHelper.MySQLSQLHelper, ERXSQLHelper.NoSQLHelper, ERXSQLHelper.OpenBaseSQLHelper, ERXSQLHelper.OracleSQLHelper, ERXSQLHelper.PostgresqlSQLHelper
 
Field Summary
 
Fields inherited from class er.extensions.jdbc.ERXSQLHelper
log
 
Constructor Summary
ERXSQLHelper.OracleSQLHelper()
           
 
Method Summary
protected  boolean canReliablyPerformDistinctWithSortOrderings()
          Returns whether or not this database can always perform the a distinct operation when sort orderings are applied.
protected  char commandSeparatorChar()
          This is totally cheating ...
protected  java.lang.String commandSeparatorString()
           
 java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entities, com.webobjects.foundation.NSArray<java.lang.String> externalTypesToIgnore)
           
 java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptions(com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entities, java.lang.String modelName, com.webobjects.foundation.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.
 java.lang.String externalTypeForJDBCType(com.webobjects.jdbcadaptor.JDBCAdaptor adaptor, int jdbcType)
          JDBCAdaptor.externalTypeForJDBCType just returns the first type it finds instead of trying to find a best match.
 java.lang.String limitExpressionForSQL(com.webobjects.eoaccess.EOSQLExpression expression, com.webobjects.eocontrol.EOFetchSpecification fetchSpecification, java.lang.String sql, long start, long end)
           
 java.lang.String migrationTableName()
          Returns the name of the table to use for database migrations.
 boolean reassignExternalTypeForValueTypeOverride(com.webobjects.eoaccess.EOAttribute attribute)
           
 java.lang.String sqlForCreateIndex(java.lang.String indexName, java.lang.String tableName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Returns the SQL expression for creating an index on the given set of columns
 java.lang.String sqlForCreateUniqueIndex(java.lang.String indexName, java.lang.String tableName, ERXSQLHelper.ColumnIndex... columnIndexes)
          Returns the SQL expression for creating a unique index on the given set of columns
protected  java.lang.String sqlForGetNextValFromSequencedNamed(java.lang.String sequenceName)
          Returns the SQL required to select the next value from the given sequence.
 java.lang.String sqlForRegularExpressionQuery(java.lang.String key, java.lang.String value)
          Returns the SQL expression for a regular expression query.
protected  java.lang.String sqlForSubquery(java.lang.String subquery, java.lang.String alias)
          Returns the syntax for using the given query as an aliased subquery in a from-clause.
 int varcharLargeColumnWidth()
          Returns the width that should be used for a varcharLarge column in migrations.
 int varcharLargeJDBCType()
          For Oracle, it seems the right thing to do for varcharLarge is to use a CLOB column.
 
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, handleDatabaseException, jdbcTypeForCustomType, maximumElementPerInClause, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, newSQLHelper, prepareConnectionForSchemaChange, quoteColumnName, readFormatForAggregateFunction, removeSelectFromExpression, restoreConnectionSettingsAfterSchemaChange, rowCountForFetchSpecification, shouldExecute, shouldPerformDistinctInMemory, splitSQLStatements, splitSQLStatementsFromFile, splitSQLStatementsFromInputStream, sqlExpressionForFetchSpecification, sqlExpressionForFetchSpecification, sqlForCreateIndex, sqlForCreateUniqueIndex, sqlForFullTextQuery, sqlWhereClauseStringForKey
 
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

sqlForSubquery

protected java.lang.String sqlForSubquery(java.lang.String subquery,
                                          java.lang.String alias)
Description copied from class: ERXSQLHelper
Returns the syntax for using the given query as an aliased subquery in a from-clause.

Overrides:
sqlForSubquery in class ERXSQLHelper
Parameters:
subquery - the subquery to wrap
alias - the alias to use
Returns:
the formatted subquery expression

sqlForGetNextValFromSequencedNamed

protected java.lang.String sqlForGetNextValFromSequencedNamed(java.lang.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 java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptions(com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entities,
                                                                            java.lang.String modelName,
                                                                            com.webobjects.foundation.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 java.lang.String limitExpressionForSQL(com.webobjects.eoaccess.EOSQLExpression expression,
                                              com.webobjects.eocontrol.EOFetchSpecification fetchSpecification,
                                              java.lang.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 java.lang.String commandSeparatorString()
Overrides:
commandSeparatorString in class ERXSQLHelper

createIndexSQLForEntities

public java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entities,
                                                  com.webobjects.foundation.NSArray<java.lang.String> externalTypesToIgnore)
Overrides:
createIndexSQLForEntities in class ERXSQLHelper

sqlForCreateUniqueIndex

public java.lang.String sqlForCreateUniqueIndex(java.lang.String indexName,
                                                java.lang.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 java.lang.String sqlForCreateIndex(java.lang.String indexName,
                                          java.lang.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 java.lang.String sqlForRegularExpressionQuery(java.lang.String key,
                                                     java.lang.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 java.lang.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 java.lang.String externalTypeForJDBCType(com.webobjects.jdbcadaptor.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(com.webobjects.eoaccess.EOAttribute attribute)
Overrides:
reassignExternalTypeForValueTypeOverride in class ERXSQLHelper

canReliablyPerformDistinctWithSortOrderings

protected boolean canReliablyPerformDistinctWithSortOrderings()
Description copied from class: ERXSQLHelper
Returns whether or not this database can always perform the a distinct operation when sort orderings are applied. Oracle, for instance, will fail if you try to sort on a key that isn't in the list of fetched keys.

Overrides:
canReliablyPerformDistinctWithSortOrderings in class ERXSQLHelper
Returns:
whether or not this database can always perform the a distinct operation when sort orderings are applied

varcharLargeJDBCType

public int varcharLargeJDBCType()
For Oracle, it seems the right thing to do for varcharLarge is to use a CLOB column. CLOB is limited to 8TB where as VARCHAR is limited to 4000 bytes.

Overrides:
varcharLargeJDBCType in class ERXSQLHelper
Returns:
the JDBCType that should be used for a varcharLarge column in migrations

varcharLargeColumnWidth

public int varcharLargeColumnWidth()
Description copied from class: ERXSQLHelper
Returns the width that should be used for a varcharLarge column in migrations.

Overrides:
varcharLargeColumnWidth in class ERXSQLHelper
Returns:
the width that should be used for a varcharLarge column in migrations

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.