ERXSQLHelper.OracleSQLHelper Class Reference

Inherits er::extensions::jdbc::ERXSQLHelper.

Inherited by ERXSQLHelper.EROracleSQLHelper.

Collaboration diagram for ERXSQLHelper.OracleSQLHelper:

Collaboration graph
[legend]

List of all members.

Public Member Functions

String createIndexSQLForEntities (NSArray< EOEntity > entities, NSArray< String > externalTypesToIgnore)
String createSchemaSQLForEntitiesInModelWithNameAndOptions (NSArray< EOEntity > entities, String modelName, NSDictionary optionsCreate)
String externalTypeForJDBCType (JDBCAdaptor adaptor, int jdbcType)
String limitExpressionForSQL (EOSQLExpression expression, EOFetchSpecification fetchSpecification, String sql, long start, long end)
String migrationTableName ()
boolean reassignExternalTypeForValueTypeOverride (EOAttribute attribute)
String sqlForCreateIndex (String indexName, String tableName, ColumnIndex...columnIndexes)
String sqlForCreateUniqueIndex (String indexName, String tableName, ColumnIndex...columnIndexes)
String sqlForRegularExpressionQuery (String key, String value)
int varcharLargeColumnWidth ()
int varcharLargeJDBCType ()

Protected Member Functions

boolean canReliablyPerformDistinctWithSortOrderings ()
char commandSeparatorChar ()
String commandSeparatorString ()
String sqlForGetNextValFromSequencedNamed (String sequenceName)
String sqlForSubquery (String subquery, String alias)


Member Function Documentation

boolean canReliablyPerformDistinctWithSortOrderings (  )  [protected]

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.

Returns:
whether or not this database can always perform the a distinct operation when sort orderings are applied

Reimplemented from ERXSQLHelper.

char commandSeparatorChar (  )  [protected]

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.

Returns:
the separator character used by this database

Reimplemented from ERXSQLHelper.

String commandSeparatorString (  )  [protected]

Reimplemented from ERXSQLHelper.

String createIndexSQLForEntities ( NSArray< EOEntity >  entities,
NSArray< String externalTypesToIgnore 
)

Reimplemented from ERXSQLHelper.

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.

See also:
createSchemaSQLForEntitiesInModelWithNameAndOptions

Reimplemented from ERXSQLHelper.

String externalTypeForJDBCType ( JDBCAdaptor  adaptor,
int  jdbcType 
)

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.

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

Reimplemented from ERXSQLHelper.

String limitExpressionForSQL ( EOSQLExpression  expression,
EOFetchSpecification  fetchSpecification,
String  sql,
long  start,
long  end 
)

Reimplemented from ERXSQLHelper.

String migrationTableName (  ) 

Returns the name of the table to use for database migrations.

Returns:
the name of the table to use for database migrations

Reimplemented from ERXSQLHelper.

boolean reassignExternalTypeForValueTypeOverride ( EOAttribute  attribute  ) 

Reimplemented from ERXSQLHelper.

String sqlForCreateIndex ( String  indexName,
String  tableName,
ColumnIndex...  columnIndexes 
)

Returns the SQL expression for creating an index on the given set of columns

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

Reimplemented from ERXSQLHelper.

String sqlForCreateUniqueIndex ( String  indexName,
String  tableName,
ColumnIndex...  columnIndexes 
)

Returns the SQL expression for creating a unique index on the given set of columns

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

Reimplemented from ERXSQLHelper.

String sqlForGetNextValFromSequencedNamed ( String  sequenceName  )  [protected]

Returns the SQL required to select the next value from the given sequence. This should return a single row with a single column.

Parameters:
sequenceName the name of the sequence
Returns:
the next sequence value

Reimplemented from ERXSQLHelper.

String sqlForRegularExpressionQuery ( String  key,
String  value 
)

Returns the SQL expression for a regular expression query.

Parameters:
key 
value 
Returns:
the regex SQL

Reimplemented from ERXSQLHelper.

String sqlForSubquery ( String  subquery,
String  alias 
) [protected]

Returns the syntax for using the given query as an aliased subquery in a from-clause.

Parameters:
subquery the subquery to wrap
alias the alias to use
Returns:
the formatted subquery expression

Reimplemented from ERXSQLHelper.

int varcharLargeColumnWidth (  ) 

Returns the width that should be used for a varcharLarge column in migrations.

Returns:
the width that should be used for a varcharLarge column in migrations

Reimplemented from ERXSQLHelper.

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.

Reimplemented from ERXSQLHelper.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:16 2012 for Project Wonder by  doxygen 1.5.8