Package org.apache.empire.dbms.oracle
Class DBMSHandlerOracle
java.lang.Object
org.apache.empire.dbms.DBMSHandlerBase
org.apache.empire.dbms.oracle.DBMSHandlerOracle
- All Implemented Interfaces:
DBMSHandler
This class provides support for the Oracle database system.
Oracle Version 9 or higher is required.
Oracle Version 9 or higher is required.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.empire.dbms.DBMSHandlerBase
DBMSHandlerBase.DBMSBuilder, DBMSHandlerBase.DBMSCommand, DBMSHandlerBase.DBSeqTableNested classes/interfaces inherited from interface org.apache.empire.dbms.DBMSHandler
DBMSHandler.DBSetGenKeys -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected static final String[]Fields inherited from class org.apache.empire.dbms.DBMSHandlerBase
GENERAL_SQL_KEYWORDS, ILLEGAL_NAME_CHARS, reservedSQLKeywords, SEQUENCE_NAME_SUFFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddStatementParam(PreparedStatement pstmt, int paramIndex, Object value) Adds a statement parameter to a prepared statementvoidappendEnableRelationStmt(DBRelation r, boolean enable, DBSQLScript script) Appends a statement to enable or disable a foreign key relation.
The default is to drop or create the relation Override this method to provide different behavior for your database.voidcheckDatabase(DBDatabase db, String owner, Connection conn) Checks whether the database definition matches the real database structure.createCommand(boolean autoPrepareStmt) Creates a new Oracle command object.Creates a DataModelChecker instance of this DBMSHandlercreateModelParser(String catalog, String schema) Creates a DataModelParser instance of this DBMSHandlerExtracts native error message of an sqlExeption.intReturns the support for collationsgetConvertPhrase(DataType destType, DataType srcType, Object format) Returns a data type convertion phrase template for this dbms
The returned template must contain a '?'voidgetDDLScript(DBDDLGenerator.DDLActionType type, DBObject dbo, DBSQLScript script) Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.getNextSequenceValue(DBDatabase db, String seqName, int minValue, Connection conn) Returns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC.
If a dbms supports this function it must return true for isSupported(DBMSFeature.SEQUENCES).Returns an expression for creating a sequence value.getResultValue(ResultSet rset, int columnIndex, DataType dataType) Gets the value of a sql ResultSet.getSQLPhrase(DBSqlPhrase phrase) Gets an sql phrase template for this database system.getUpdateTimestamp(Connection conn) Overridden.booleanbooleanisSupported(DBMSFeature type) Returns whether or not a particular feature is supported by this dbmsvoidrefreshMView(DBMaterializedView matView, DBContext context) Immediately refreshes a Materialized ViewvoidsetBooleanType(DBMSHandlerOracle.BooleanType booleanType) voidsetCollationSupport(int collationSupport) Returns the support for collations 0 = none 1 = index column definition 2 = table column definition 3 = table and index column definitionvoidsetOracle8Compatibilty(boolean oracle8Compatibilty) voidsetSchemaName(String schemaName) Methods inherited from class org.apache.empire.dbms.DBMSHandlerBase
addSQLKeyword, appendObjectName, attachDatabase, checkExists, closeResultSet, closeStatement, createCombinedCommand, createSQLBuilder, detachDatabase, detectQuoteName, executeBatch, executeQuery, executeSQL, getColumnAutoValue, getColumnSequenceName, getIgnoreCaseExpr, prepareStatement, querySingleValue
-
Field Details
-
COLATTR_COLLATION
- See Also:
-
COLATTR_SQLEXPRESSION
- See Also:
-
ORACLE_KEYWORDS
-
-
Constructor Details
-
DBMSHandlerOracle
public DBMSHandlerOracle()Constructor for the Oracle database dbms.
-
-
Method Details
-
isOracle8Compatibilty
public boolean isOracle8Compatibilty() -
setOracle8Compatibilty
public void setOracle8Compatibilty(boolean oracle8Compatibilty) -
getBooleanType
-
setBooleanType
-
getCollationSupport
public int getCollationSupport()Returns the support for collations- Returns:
- the column support
- See Also:
-
setCollationSupport
public void setCollationSupport(int collationSupport) Returns the support for collations 0 = none 1 = index column definition 2 = table column definition 3 = table and index column definition- Parameters:
collationSupport- the type of collation support
-
getSchemaName
-
setSchemaName
-
isSupported
Returns whether or not a particular feature is supported by this dbms- Specified by:
isSupportedin interfaceDBMSHandler- Specified by:
isSupportedin classDBMSHandlerBase- Parameters:
type- type of requested feature. @see DBMSFeature- Returns:
- true if the features is supported or false otherwise
-
createCommand
Creates a new Oracle command object.- Specified by:
createCommandin interfaceDBMSHandler- Overrides:
createCommandin classDBMSHandlerBase- Parameters:
autoPrepareStmt- flag whether to automatically provide literal values as prepared statement params- Returns:
- the new DBCommandOracle object
-
getSQLPhrase
Gets an sql phrase template for this database system.- Parameters:
phrase- the identifier of the phrase- Returns:
- the phrase template
- See Also:
-
getConvertPhrase
Description copied from interface:DBMSHandlerReturns a data type convertion phrase template for this dbms
The returned template must contain a '?' which will be replaced by a column expression.- Parameters:
destType- the target data typesrcType- the source data typeformat- additional formatting information (optional)- Returns:
- the data conversion phrase template
- See Also:
-
addStatementParam
protected void addStatementParam(PreparedStatement pstmt, int paramIndex, Object value) throws SQLException Adds a statement parameter to a prepared statement- Overrides:
addStatementParamin classDBMSHandlerBase- Parameters:
pstmt- the prepared statementparamIndex- the parameter indexvalue- the parameter value- Throws:
SQLException- thrown if a database access error occurs
-
extractErrorMessage
Extracts native error message of an sqlExeption.- Specified by:
extractErrorMessagein interfaceDBMSHandler- Overrides:
extractErrorMessagein classDBMSHandlerBase- Parameters:
sqle- the SQLException- Returns:
- the error message of the database
-
getResultValue
public Object getResultValue(ResultSet rset, int columnIndex, DataType dataType) throws SQLException Gets the value of a sql ResultSet. Gives the dbms the oportunity to change the value i.e. to simulate missing data types with other types.- Specified by:
getResultValuein interfaceDBMSHandler- Overrides:
getResultValuein classDBMSHandlerBase- Parameters:
rset- the sql Resultset with the current data rowcolumnIndex- one based column Index of the desired columndataType- the desired data type- Returns:
- the value of the column
- Throws:
SQLException- if a database access error occurs
-
getNextSequenceValue
Description copied from class:DBMSHandlerBaseReturns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC.
If a dbms supports this function it must return true for isSupported(DBMSFeature.SEQUENCES).- Specified by:
getNextSequenceValuein classDBMSHandlerBase- Parameters:
db- the databaseseqName- the name of the sequenceminValue- the minimum value of the sequenceconn- a valid database connection- Returns:
- a new unique sequence value or null if an error occurred
- See Also:
-
getNextSequenceValueExpr
Description copied from class:DBMSHandlerBaseReturns an expression for creating a sequence value. This is intended for the use with INSERT INTO statements where many records are affected.- Specified by:
getNextSequenceValueExprin classDBMSHandlerBase- Parameters:
column- the column for which to obtain an expression providing the next sequence value- Returns:
- an expression for the next sequence value
- See Also:
-
getUpdateTimestamp
Overridden. Returns a timestamp that is used for record updates created by the database server.- Specified by:
getUpdateTimestampin interfaceDBMSHandler- Overrides:
getUpdateTimestampin classDBMSHandlerBase- Parameters:
conn- the connection that might be used- Returns:
- the current date and time of the database server.
-
getDDLScript
Description copied from interface:DBMSHandlerAppends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.- Parameters:
type- operation to perform (CREATE, DROP, ALTER)dbo- the object for which to perform the operation (DBDatabase, DBTable, DBView, DBColumn, DBRelation)script- the script to which to add the DDL command(s)- See Also:
-
appendEnableRelationStmt
Description copied from class:DBMSHandlerBaseAppends a statement to enable or disable a foreign key relation.
The default is to drop or create the relation Override this method to provide different behavior for your database.- Specified by:
appendEnableRelationStmtin interfaceDBMSHandler- Overrides:
appendEnableRelationStmtin classDBMSHandlerBase- Parameters:
r- the foreign key relation which should be enabled or disabledenable- true to enable the relation or false to disablescript- the script to which to add the DDL command(s)- See Also:
-
checkDatabase
Checks whether the database definition matches the real database structure. -
createModelParser
Description copied from class:DBMSHandlerBaseCreates a DataModelParser instance of this DBMSHandler- Specified by:
createModelParserin interfaceDBMSHandler- Overrides:
createModelParserin classDBMSHandlerBase- Parameters:
catalog- the database catalogschema- the database schema- Returns:
- the model parser
-
createModelChecker
Creates a DataModelChecker instance of this DBMSHandler- Specified by:
createModelCheckerin interfaceDBMSHandler- Overrides:
createModelCheckerin classDBMSHandlerBase- Parameters:
db- the database- Returns:
-
refreshMView
Immediately refreshes a Materialized View- Parameters:
matView- the materialized view to refreshcontext- the database context
-