com.sibvisions.rad.persist.jdbc
Class AbstractOracleDBAccess

java.lang.Object
  extended by com.sibvisions.rad.persist.jdbc.DBAccess
      extended by com.sibvisions.rad.persist.jdbc.AbstractOracleDBAccess
All Implemented Interfaces:
IDBAccess, ICloseable
Direct Known Subclasses:
OracleDBAccess, TiberoDBAccess

public abstract class AbstractOracleDBAccess
extends DBAccess

The AbstractOracleDBAccess is the base implementation for Oracle databases.

See Also:
DBAccess

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
DBAccess.BlobFileHandle, DBAccess.ParameterizedStatement
 
Field Summary
 
Fields inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
BFILE, LONGNVARCHAR, NCHAR, NCLOB, NVARCHAR, QUOTE, SQLXML, TIMESTAMPWITHLOCALTIMEZONE, TIMESTAMPWITHTIMEZONE
 
Constructor Summary
AbstractOracleDBAccess()
           
 
Method Summary
protected abstract  java.lang.Object convertArrayToList(java.lang.Object pParam)
          Converts arrays to List of IBean.
protected abstract  java.lang.Object convertToArray(AbstractParam pParam)
          Converts list or array to oracle arrays.
protected  boolean detectModified()
          Detects if a transaction is open directly in the database.
 java.lang.Object executeFunction(java.lang.String pFunctionName, OutParam pReturnOutParam, java.lang.Object... pParameters)
          Executes a DB function with the specified parameters and return the result.
 void executeProcedure(java.lang.String pProcedureName, java.lang.Object... pParameters)
          Executes a DB procedure with the specified parameters.
protected  java.util.Map<java.lang.String,java.lang.Object[]> getAllowedValuesIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable)
          Gets the allowed values from a specific table.
 java.lang.String getDatabaseSpecificLockStatement(java.lang.String pWritebackTable, ServerMetaData pServerMetaData, ICondition pPKFilter)
          Returns the database specific statement to lock the specified row in the database.
protected  java.util.Map<java.lang.String,java.lang.Object> getDefaultValuesIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable)
          Gets all default column values of a specific table.
protected  java.util.List<ForeignKey> getForeignKeysIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable)
          Returns all Foreign Keys for the specified table.
protected  Key getPrimaryKeyIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable)
          It's gets all Primary Key columns and return it as String[].
protected  java.lang.String getTableForSynonymIntern(java.lang.String pStatement, java.lang.String pSynomyn)
          Gets the table name for a synonym.
protected  TableInfo getTableInfoIntern(java.lang.String pWriteBackTable)
          Returns the meta data information for the specified query, and configures all columns with defaults.
protected  java.util.List<Key> getUniqueKeysIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable)
          It gets all columns for each Unique Key and return it.
 java.lang.Object[] insertDatabaseSpecific(java.lang.String pWriteBackTable, java.lang.String pInsertStatement, ServerMetaData pServerMetaData, java.lang.Object[] pNewDataRow, java.lang.String pDummyColumn)
          Returns the newly inserted row from a Database specific insert statement.
protected  java.lang.Object[] insertOracle(java.lang.String pTablename, java.lang.String pInsertStatement, ServerMetaData pServerMetaData, java.lang.Object[] pNewDataRow, java.lang.String pDummyColumn)
          Returns the newly inserted row from an Oracle Database.
 void open()
          It opens the database and stores the Connection object.
 
Methods inherited from class com.sibvisions.rad.persist.jdbc.DBAccess
clearMetaData, clearMetaData, close, commit, commitOrRollbackBeforeClose, convertDatabaseSpecificObjectToValue, convertValueToDatabaseSpecificObject, createIdentifier, createReplace, createServerColumnMetaData, createWhereColumn, createWhereParam, debug, delete, error, eventConfigureConnection, eventUnconfigureConnection, executeFunction, executeQuery, executeSql, executeSqlMulti, executeStatement, fetch, fetch, fetch, fetch, findAndCreateReducedCondition, findNamedParameters, fireEventConfigureConnection, fireEventUnconfigureConnection, formatSQLException, formatSQLException, getAllowedValues, getAutomaticLinkColumnNameTranslation, getCloseQuoteCharacter, getColumnMetaData, getColumnMetaDataCreator, getColumnMetaDataIntern, getColumnName, getConnection, getConnectionIntern, getConnectionPool, getDBAccess, getDBAccess, getDBAccess, getDBAccess, getDBAccess, getDBProperties, getDBProperty, getDefaultAllowedValues, getDefaultCursorCacheTimeout, getDefaultLargeObjectLimit, getDefaultSchema, getDefaultValues, getDiscardRowCount, getDriver, getForeignKeys, getIdentifier, getLargeObjectLimit, getMaxColumnLength, getMaxTime, getMetaDataCacheOption, getMetaDataWhereClause, getObjectFromResultSet, getObjectFromResultSet, getOpenQuoteCharacter, getParameter, getParameter, getParameterizedSelectStatement, getPassword, getPreparedStatement, getPreparedStatement, getPrimaryKey, getQueryTimeout, getRealQueryColumnName, getSelectStatement, getSelectStatement, getSQL, getTableForSynonym, getTableForSynonymIntern, getTableInfo, getTransactionTimeout, getUniqueKeys, getUrl, getUsername, getWhereClause, info, initializeColumnMetaData, initializeDataType, initializeServerColumnMetaData, insert, insertAnsiSQL, isAutoCommit, isAutoQuote, isConnectionPoolEnabled, isJdbc, isLogEnabled, isMetaDataCacheEnabled, isModified, isOpen, isReleaseConnectionPending, isTypeEqual, lockRow, lockRowInternal, prepareConnection, quote, quoteAllways, registerDBAccessClass, releaseConnection, releaseConnectionIntern, removeDBSpecificQuotes, removeQuotes, rollback, setAutoCommit, setAutomaticLinkColumnNameTranslation, setColumnMetaDataCreator, setColumnMetaDataCreator, setColumnsToStore, setConnection, setConnectionPool, setConnectionPoolEnabled, setDBProperties, setDBProperty, setDefaultCursorCacheTimeout, setDefaultLargeObjectLimit, setDefaultSchema, setDriver, setLargeObjectLimit, setMaxTime, setMetaDataCacheOption, setModified, setPassword, setQueryTimeout, setQuoteCharacters, setTransactionTimeout, setUrl, setUsername, splitSchemaTable, supportsGetGeneratedKeys, toString, translateDefaultValue, translateQuotes, translateValue, update, updateAnsiSQL, updateDatabaseSpecific
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractOracleDBAccess

public AbstractOracleDBAccess()
Method Detail

convertArrayToList

protected abstract java.lang.Object convertArrayToList(java.lang.Object pParam)
                                                throws java.sql.SQLException
Converts arrays to List of IBean.

Parameters:
pParam - the param to check
Returns:
the param or a list in case of array.
Throws:
java.sql.SQLException - the exception

convertToArray

protected abstract java.lang.Object convertToArray(AbstractParam pParam)
                                            throws java.sql.SQLException
Converts list or array to oracle arrays.

Parameters:
pParam - the param to check
Returns:
the param or a list in case of array.
Throws:
java.sql.SQLException - the exception

getDatabaseSpecificLockStatement

public java.lang.String getDatabaseSpecificLockStatement(java.lang.String pWritebackTable,
                                                         ServerMetaData pServerMetaData,
                                                         ICondition pPKFilter)
                                                  throws DataSourceException
Returns the database specific statement to lock the specified row in the database.

Overrides:
getDatabaseSpecificLockStatement in class DBAccess
Parameters:
pWritebackTable - the table to use.
pServerMetaData - the MetaDataColumn array to use.
pPKFilter - the PK filter with the values to use.
Returns:
the database specific statement to lock the specified row in the database.
Throws:
DataSourceException - if some parts are missing for the statement

insertDatabaseSpecific

public java.lang.Object[] insertDatabaseSpecific(java.lang.String pWriteBackTable,
                                                 java.lang.String pInsertStatement,
                                                 ServerMetaData pServerMetaData,
                                                 java.lang.Object[] pNewDataRow,
                                                 java.lang.String pDummyColumn)
                                          throws DataSourceException
Returns the newly inserted row from a Database specific insert statement.
Database specific derivations of DBAccess need to implement it database specific.

Overrides:
insertDatabaseSpecific in class DBAccess
Parameters:
pWriteBackTable - the table to use for the insert
pInsertStatement - the SQL Statement to use for the insert
pServerMetaData - the meta data to use.
pNewDataRow - the new row (Object[]) with the values to insert
pDummyColumn - null, if all writeable columns are null, but for a correct INSERT it have to be minimum one column to use in the syntax.
Returns:
the newly inserted row from an Oracle Database.
Throws:
DataSourceException - if an Exception occur during insert to the storage

open

public void open()
          throws DataSourceException
It opens the database and stores the Connection object.

Overrides:
open in class DBAccess
Throws:
DataSourceException - if the database couldn't opened

getUniqueKeysIntern

protected java.util.List<Key> getUniqueKeysIntern(java.lang.String pCatalog,
                                                  java.lang.String pSchema,
                                                  java.lang.String pTable)
                                           throws DataSourceException
It gets all columns for each Unique Key and return it.

Overrides:
getUniqueKeysIntern in class DBAccess
Parameters:
pCatalog - the catalog to use
pSchema - the schema to use
pTable - the table to use
Returns:
all columns for each Unique Key.
Throws:
DataSourceException - if an error occur during UK search process.

getPrimaryKeyIntern

protected Key getPrimaryKeyIntern(java.lang.String pCatalog,
                                  java.lang.String pSchema,
                                  java.lang.String pTable)
                           throws DataSourceException
It's gets all Primary Key columns and return it as String[]. Gets all Primary Key columns and return it as list of Strings.

Overrides:
getPrimaryKeyIntern in class DBAccess
Parameters:
pCatalog - the catalog to use
pSchema - the schema to use
pTable - the table to use
Returns:
all Primary Key columns and return it as String[].
Throws:
DataSourceException - if an error occur during PK search process.

getForeignKeysIntern

protected java.util.List<ForeignKey> getForeignKeysIntern(java.lang.String pCatalog,
                                                          java.lang.String pSchema,
                                                          java.lang.String pTable)
                                                   throws DataSourceException
Returns all Foreign Keys for the specified table.

Overrides:
getForeignKeysIntern in class DBAccess
Parameters:
pCatalog - the catalog to use
pSchema - the schema to use
pTable - the table to use as base table.
Returns:
all Foreign Keys for the specified table.
Throws:
DataSourceException - if an error occur in determining the ForeignKeys.

getDefaultValuesIntern

protected java.util.Map<java.lang.String,java.lang.Object> getDefaultValuesIntern(java.lang.String pCatalog,
                                                                                  java.lang.String pSchema,
                                                                                  java.lang.String pTable)
                                                                           throws DataSourceException
Gets all default column values of a specific table.

Overrides:
getDefaultValuesIntern in class DBAccess
Parameters:
pCatalog - the catalog name
pSchema - the schema name
pTable - the table name
Returns:
a Hashtable with the column name as key and the default value as value. It only contains columns with a default value
Throws:
DataSourceException - if the database access throws an exception

getAllowedValuesIntern

protected java.util.Map<java.lang.String,java.lang.Object[]> getAllowedValuesIntern(java.lang.String pCatalog,
                                                                                    java.lang.String pSchema,
                                                                                    java.lang.String pTable)
                                                                             throws DataSourceException
Gets the allowed values from a specific table. The allowed values are defined through check constraints or other table related restrictions.

Overrides:
getAllowedValuesIntern in class DBAccess
Parameters:
pCatalog - the catalog name
pSchema - the schema name
pTable - the table to check
Returns:
a Hashtable with a column name as key and the allowed values as array of Objects or null if there are no allowed values
Throws:
DataSourceException - if the database access throws an exception

getTableInfoIntern

protected TableInfo getTableInfoIntern(java.lang.String pWriteBackTable)
                                throws DataSourceException
Returns the meta data information for the specified query, and configures all columns with defaults.

Overrides:
getTableInfoIntern in class DBAccess
Parameters:
pWriteBackTable - the write back table to use for the isWriteable() state (Optional)
Returns:
the meta data for the specified query, and initials all columns.
Throws:
DataSourceException - if an Exception occur during getting the meta data or if the storage is not opened or if one columns SQL type is not supported

detectModified

protected boolean detectModified()
Detects if a transaction is open directly in the database.

Overrides:
detectModified in class DBAccess
Returns:
true, if a transaction is open directly in the database.

executeFunction

public java.lang.Object executeFunction(java.lang.String pFunctionName,
                                        OutParam pReturnOutParam,
                                        java.lang.Object... pParameters)
                                 throws java.sql.SQLException
Executes a DB function with the specified parameters and return the result.

Overrides:
executeFunction in class DBAccess
Parameters:
pFunctionName - the function (optional with package) name.
pReturnOutParam - the return SQL Type (see Types
pParameters - the parameters to use with the correct and corresponding java type.
Returns:
the result of the DB function call.
Throws:
java.sql.SQLException - if the call failed.

executeProcedure

public void executeProcedure(java.lang.String pProcedureName,
                             java.lang.Object... pParameters)
                      throws java.sql.SQLException
Executes a DB procedure with the specified parameters.

Overrides:
executeProcedure in class DBAccess
Parameters:
pProcedureName - the procedure (optional with package) name.
pParameters - the parameters to use with the correct and corresponding java type.
Throws:
java.sql.SQLException - if the call failed.

insertOracle

protected java.lang.Object[] insertOracle(java.lang.String pTablename,
                                          java.lang.String pInsertStatement,
                                          ServerMetaData pServerMetaData,
                                          java.lang.Object[] pNewDataRow,
                                          java.lang.String pDummyColumn)
                                   throws DataSourceException
Returns the newly inserted row from an Oracle Database.
It uses RETURNING .. INTO to get the primary key values back from the database.

Parameters:
pTablename - the table to use for the insert
pInsertStatement - the SQL Statement to use for the insert
pServerMetaData - the meta data to use.
pNewDataRow - the new IDataRow with the values to insert
pDummyColumn - true, if all writeable columns are null, but for a correct INSERT it have to be minimum one column to use in the syntax.
Returns:
the newly inserted row from an Oracle Database.
Throws:
DataSourceException - if an Exception occur during insert the IDataRow to the storage

getTableForSynonymIntern

protected java.lang.String getTableForSynonymIntern(java.lang.String pStatement,
                                                    java.lang.String pSynomyn)
                                             throws DataSourceException
Gets the table name for a synonym.

Parameters:
pStatement - the synonym metadata statement
pSynomyn - the name of the synonym
Returns:
the name of the table or the pSynonym name if no synonym was found
Throws:
DataSourceException - if synonym detection failed


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.