Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.6.0)

E10653-07

oracle.jbo.server
Class OracleSQLBuilderImpl

java.lang.Object
  extended by oracle.jbo.common.CommonCriteriaAdapter
      extended by oracle.jbo.server.CriteriaAdapterImpl
          extended by oracle.jbo.server.BaseSQLBuilderImpl
              extended by oracle.jbo.server.OracleSQLBuilderImpl
All Implemented Interfaces:
CriteriaAdapter, SQLBuilder, ViewCriteriaAdapter

public class OracleSQLBuilderImpl
extends BaseSQLBuilderImpl

Oracle specific implementation of the SQLBuilder interface.

Since:
JDeveloper 3.0

Field Summary
protected static java.lang.String ORACLE_ROWID_COLUMN
          Oracle specific column name for ROWID.
 
Fields inherited from interface oracle.jbo.server.SQLBuilder
BINDING_STYLE_JDBC, BINDING_STYLE_ORACLE, BINDING_STYLE_ORACLE_NAME, BINDING_STYLE_UNKNOWN, DML_DELETE, DML_INSERT, DML_UPDATE, MAX_COLUMN_IDENTIFIER_LEN, RANGE_PAGE_BIND_HIGH_ROWNUM, RANGE_PAGE_BIND_LOW_ROWNUM
 
Constructor Summary
protected OracleSQLBuilderImpl()
          This is a singleton class.
 
Method Summary
protected static java.lang.String addSqlTypeText(java.lang.String sqlText, java.lang.String inputType)
          A helper method for getTableList.
 int bindInsertStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.HashMap retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the INSERT statement.
protected  int bindParamValue(int bindingStyle, java.lang.Object value, DBTransactionImpl trans, java.sql.PreparedStatement stmt, AttributeDefImpl attrDef, int bindIndex, boolean skipNull)
          Binds a parameter value to the Statement's bind index dealing with Null values appropriately.
 void bindRangePagingParams(java.sql.PreparedStatement stmt, ViewObjectImpl vo, int nextParamIndex, int rangeStart, int rangeSize)
           
 int bindUpdateStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.HashMap retrList, boolean batchMode)
          Binds the entity attribute storage with the parameters in the UPDATE statement.
protected  int bindWhereAttrValue(EntityImpl entityContext, DBTransactionImpl trans, java.sql.PreparedStatement stmt, AttributeDefImpl attrDef, int bindIndex, boolean skipNull)
          Binds an attribute value to the Statement's WHERE clause parameter index dealing with Null values appropriately.
 void buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause, java.util.List eRefs, BaseViewCriteriaManagerImpl vcManager)
          This method is used to generate the "from" clause if the following conditions are met: The View Object definition does not have an expert mode query The View Object definition is set to generate "from" clause during runtime, either in metadata or by calling ViewDefImpl.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
 java.util.HashMap buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause, java.util.List eRefs, java.util.List forcedERefs, EntityReference[][] newEntRefsArr, boolean isInlineViewForFroms)
          This method is used to generate the "where" clause if the following conditions are met: The View Object definition does not specify "where" clause The View Object definition is set to generate "where" clause during runtime, either in metadata or by calling ViewDefImpl.setWhereClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
 java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
          Build a DELETE SQL for the Entity Object.
 java.lang.String buildEffDtDateDayAddStatement()
          Returns a statement that returns a date that is 'x' number of days apart from the specified date.
 java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          Build a INSERT SQL for the Entity Object skipping non-persistent values.
 void buildOptUpdateWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] cols)
          This method binds the unfetched attributes in the list or the change indicator column of an entity definition.
 java.lang.String buildRangePagingQuery(ViewObjectImpl vo, java.lang.String qry, int noUserParams)
           
protected  void buildReturningClause(java.lang.StringBuffer sqlBuffer, DBTransactionImpl trans, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode, boolean oracleBinding)
          Create a statement to use the RETURNING clause for the entity attributes that need to be fetched after a successful INSERT or UPDATE.
 void buildSelectString(DBTransactionImpl trans, java.lang.StringBuffer buffer, java.lang.String sourceName, java.lang.String sourceAlias, AttributeDefImpl[] attrs, boolean withIntoClause, int bindingStyle)
          Build a list of columns that could be used in a SELECT statement.
 java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          Build a UPDATE SQL for the Entity Object skipping non-persistent values.
 void buildWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] keyCols, java.lang.Object rowid)
          Creates a WHERE clause containing the Primary Key columns passed to the method.
 boolean compareFetchedValue(EntityImpl entity, AttributeDefImpl ad, java.lang.Object cacheValue, java.lang.Object fetchedValue)
          Overridden for Oracle because in OracleDB, in cache we may have "" string that was posted and DB assumes that string as null and returns null on fetch again.
 java.lang.Object convertValueToStorageType(java.lang.Object value)
          This method is used to convert the Java type to a JDBC type so that it could be used to bind as a parameter for SQL execution.
 void doEntityDML(EntityImpl entityContext, int operation, TransactionEvent e)
          Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.
 void doEntitySelectForAltKey(EntityImpl entityContext, int keyIndex, boolean lock)
           
 java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrDefs, int attrIndex, java.sql.ResultSet rs, int index, DBTransactionImpl trans)
          Loads an array of objects from a result set.
 java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, byte attrLoad, java.sql.ResultSet rs, int index, DBTransactionImpl trans)
          Loads an object from a result set.
 java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, java.sql.PreparedStatement ps, int index, Transaction trans)
          Loads an object from a result set.
 void doPreparedStatementDefineColumnType(java.sql.PreparedStatement ps, int colnum, int sqltype)
          Performs the equivalent of defineColumnType() on a prepared statement.
 void doPreparedStatementDefines(java.sql.PreparedStatement stmt, AttributeDefImpl[] columns)
          Defines the column types of the attributes based on the meta-data.
 void doStatementSetBindingStyle(java.sql.Statement ps, int bindingStyle)
          Sets the binding style for the statement.
 void doStatementSetBindingStyleDefault(java.sql.Statement ps)
          Sets the binding style to the default value of the database type.
 void doStatementSetRowPrefetch(java.sql.Statement ps, int prefetchSize)
          Performs the equivalent of setRowPrefetch() on a statement.
 void executeBatch(java.sql.PreparedStatement stmt)
          Executes the PreparedStatement in batch mode.
 java.lang.Object generatePKBasedRef(EntityImpl entityContext)
          Generates a PK-Based REF for an Entity Object.
 java.lang.Object[] generateRefAndOID(EntityImpl entityContext)
          Generates an object Ref and OID for an Entity Object.
 java.lang.String getBaseTable(java.sql.Connection conn, java.lang.String schema, java.lang.String name)
          Unroll any synonyms that may be present, and get the real objectname.
 java.lang.String getClauseForDateLiteral(java.util.Date date)
          Creates a database platform specific clause for converting a date string literal to date datatype.
 java.util.ArrayList getConstraintsList(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          Return vector with constraint details for this table where each detail is in a String array with this structure: 0 String owner
 java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName, java.lang.String tableName, java.util.ArrayList sequenceNames, java.util.ArrayList colNames)
          Returns a SQL statement that creates a trigger that updates a column with the value from a sequence upon the creation of a new row.
 java.lang.String getCreateSequenceSQL(java.lang.String sequenceName, int startVal)
          Returns a SQL statement that creates a Sequence with an initial value specified in the argument.
 java.util.ArrayList getDBOperationList(java.sql.Connection connection, java.lang.String userName, java.lang.String packageFilter, java.lang.String operationFilter)
          Return a list of packages visible in this connection.
 java.util.ArrayList getDBPackageList(java.sql.Connection connection, java.lang.String userName, java.lang.String packageFilter)
          Return a list of packages visible in this connection.
 java.lang.String getDbTimeQuery()
          Returns a SQL statement to obtain the current time from the database.
 java.lang.String getDbType()
          Returns a string uniquely identifying this type of SQLBuilder.
 int getDefaultBindingStyle()
          Default binding style for this SQLBuilder is Oracle Named parameters.
 java.lang.String getDropSequenceSQL(java.lang.String sequenceName)
          Returns a SQL statement that drops a specified Sequence.
 java.lang.String getDropTableSQL(java.lang.String dbObjectName)
          Returns a SQL statement that drops a specified table.
 java.lang.String getFormattedLHSCompareFragment(ViewObject vo, ViewCriteria vc, AttributeDef attrDef, int sqltype, java.lang.String lhs, java.lang.Object rhs)
          This method provides a formatted left-hand-comparator fragment of a comparision in a where clause for the given column.
 java.lang.String getFormattedRHSCompareFragment(ViewObject vo, ViewCriteria vc, AttributeDef attrDef, int sqlType, java.lang.String rhs)
          Override this method to provide a formatted right-hand-comparator fragment of a comparision in a where clause for the given column.
static SQLBuilder getInterface()
          Gets the singleton instance of this class.
protected  java.lang.String getJDBCDriverClassName(java.lang.String url)
          Concrete implementations of SQLBuilder must elect a default driver name.
 java.util.ArrayList getNestedTables(java.sql.Connection conn)
          Returns a list of nested tables in this connection.
 java.lang.String getPersistManagerClassName()
          Returns the name of default PersistManager class name.
protected  java.lang.Object getROWID(EntityImpl entityContext)
          Get the ROWID attribute.
 java.util.Vector getSchemaList(java.sql.Connection connection)
          Return a list of schemas for this database (note that for Oracle this is synonymous with users)
protected  java.lang.String getSqlVariantLockTrailer()
          This defines the string that will be post-fixed to SQL statements to have the rows locked - if the DB is incapable of this then it should return null.
protected  java.lang.String getSqlVariantLockTrailer(EntityImpl entityContext)
          Invokes the default getSqlVariantLockTrailer() method.
protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap, boolean bCount)
          A helper method for getTableList.
protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap, boolean bCount, boolean bIncludeNested)
          A helper method for getTableList.
protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName, java.lang.String userName, java.lang.String nameFilter, boolean bTable, boolean bAlias, boolean bView, boolean bSnap, boolean bCount, boolean bIncludeNested)
          A helper method for getTableList.
 java.util.ArrayList getTables(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap)
          Return a list of tables visible in this connection.
 java.util.ArrayList getTables(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, boolean bTable, boolean bAlias, boolean bView, boolean bSnap, boolean bIncludeNested)
          Return a list of tables visible in this connection.
 java.util.ArrayList getTables(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, java.lang.String nameFilter, boolean bTable, boolean bAlias, boolean bView, boolean bSnap)
          Return a list of tables visible in this connection.
 java.util.ArrayList getTables(java.sql.Connection conn, java.lang.String defaultUserName, java.lang.String userName, java.lang.String nameFilter, boolean bTable, boolean bAlias, boolean bView, boolean bSnap, boolean bIncludeNested)
          Return a list of tables visible in this connection.
 java.lang.String getTypeMapName()
          The default type map for a Oracle database is ORACLE.
 java.lang.String getVersion()
          Gets a string describing the version of this implentation of this interface.
 boolean invalidDatumFactoryUsage(java.lang.String colType, int id, java.lang.Class clz)
          Returns false only for types where raw-bytes may be used to create the desired attribute values while fetching data from jdbc.
 boolean isConnectionAlive(java.sql.Connection conn)
          Detects if a connection is alive.
protected  boolean isDateOrTimeTypeVariable(Variable var)
           
 boolean isDisplayBindValueUI()
          For Oracle database the test SQL wizards provide additional functionality to bind the parameters with test values.
 boolean isNCharType(java.sql.Statement stmt, int index)
          Tests if the select statement at a given column index corresponds to an international character column.
 boolean isStreamType(int sqlTypeId)
          Check if a given type provides streaming support.
 void jdbcClientSideSecurity(java.util.Properties info, java.util.Hashtable env)
          Populates the properties with known security attributes found in the environment.
protected  boolean needsQuotedTableName(java.lang.String tableName)
          Inspects the table name if it needs to be escaped with quotes.
 void processException(java.lang.String errorCode, java.lang.Exception sqlEx, java.lang.Object[] params)
          Handle SQL exceptions by wrapping into SQLStmtException or JboException.
 ADFDatabaseChangeListener registerDatabaseChangeListener(QueryCollection listener, java.sql.Connection conn, java.sql.Statement stmt)
          Register a Query Collection to listen to database data change events.
 void releaseSavepoint(java.sql.Connection conn, java.lang.String id)
          Release SAVEPOINT if possible.
 void rollbackToSavepoint(java.sql.Connection conn, java.lang.String id)
          Rollback to SAVEPOINT if possible.
 void setSavepoint(java.sql.Connection conn, java.lang.String id)
          Issue a SAVEPOINT if possible.
 void setSessionTimeZone(java.sql.Connection conn, java.lang.String regionName)
          Sets the user session timezone on the Connection object.
 boolean shouldPutJoinConstraintInFromClause()
          Checks if the FROM clause allows view criteria.
 boolean supportsReturningClause()
          Oracle database supports RETURNING clause.
 boolean supportsRowNumQuery()
          Oracle database supports rownum in a query.
 
Methods inherited from class oracle.jbo.server.BaseSQLBuilderImpl
baseBuildSelectList, bindDeleteStatement, bindEffDtDateDayAddStatement, bindOptUpdateWhereClause, bindParametersForStmt, bindWhereClause, bindWhereClause, buildDefaultViewObjectFromClause, buildSelectList, buildSelectString, capabilityCanReuseLockStatements, checkTableNameForQuotes, containsTableAlias, convertFlags, convertValueToWhereFragment, convertValueToWhereFragment, createHandleForCancellableStatements, doEntitySelect, doRefreshSQL, doRegisterDefaultDriver, dumpConstraint, findTableAliasInSQLExpr, generateRowID, getANSIJoinVCs, getBindingStyleValue, getCappedQueryHitCountSQL, getColumnNameWithFormatForQuery, getConstraints, getCurrentDbTime, getEscapeClause, getFormattedRHSCompareFragment, getLockTrailerIsAtEnd, getMaxTableNameLength, getQueryHitCountSQL, getQuotationMarkLeft, getQuotationMarkRight, getSchemas, getStringConcatOper, getSupportsAliasInUpdateStatements, getTableList, getTableList, getViewCriteriaAdapter, getWarningText, getWildCardEscapeVal, handleSQLException, isDataSourceJTABased, isNewLineAllowedInSQL, isSQLRecoverableException, lookupDataSource, populateCompOpers, populateJboTypeMapEntries, processClauseForSubQuery, processClauseReplaceTableAliases, shouldSkipDML
 
Methods inherited from class oracle.jbo.server.CriteriaAdapterImpl
formatAttributeValue, getBindValsForSqlGen, getFormattedLHSCompareFragment, getFormattedRHSCompareFragment, getRowSetForSqlGen, getViewCriteriaClause, getWhereFragmentFromVO, isCriteriaItemOuterJoined, isLHSFragmentOptional, setupBindVarExtendedData
 
Methods inherited from class oracle.jbo.common.CommonCriteriaAdapter
cleanUpTemporaryBindVariables, cleanUpTemporaryBindVars, convertCriteriaItemToWhereFragment, convertOpandRHSToWhereFragment, convertValueToWhereFragment, correctOprandLiteral, createTempBindVar, createTemporaryBindVar, doConvertCriteriaItemToWhereFragment, getCriteriaClause, getCriteriaClause, getFormattedLHSCompareFragment, getOptionalItemClause, isCharType, isDateType, isNumericType, parseOperatorAndValueFromItemValue, shouldUseTempBindVariableForValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jbo.server.SQLBuilder
isCharType, isNumericType
 

Field Detail

ORACLE_ROWID_COLUMN

protected static final java.lang.String ORACLE_ROWID_COLUMN
Oracle specific column name for ROWID.

See Also:
Constant Field Values
Constructor Detail

OracleSQLBuilderImpl

protected OracleSQLBuilderImpl()
This is a singleton class.

Method Detail

getInterface

public static SQLBuilder getInterface()
Gets the singleton instance of this class.

Returns:
a SQLBuilder object.

getVersion

public java.lang.String getVersion()
Description copied from interface: SQLBuilder
Gets a string describing the version of this implentation of this interface.

Specified by:
getVersion in interface SQLBuilder
Specified by:
getVersion in class BaseSQLBuilderImpl
Returns:
a String containing the version.

getDbType

public java.lang.String getDbType()
Description copied from interface: SQLBuilder
Returns a string uniquely identifying this type of SQLBuilder. Examples are: "Oracle", "OLite", "SQL92".

Specified by:
getDbType in interface SQLBuilder
Specified by:
getDbType in class BaseSQLBuilderImpl
Returns:
a String containing the Database type.

getTypeMapName

public java.lang.String getTypeMapName()
The default type map for a Oracle database is ORACLE.

Specified by:
getTypeMapName in interface SQLBuilder
Specified by:
getTypeMapName in class BaseSQLBuilderImpl
Returns:
PropertyConstants.ORACLE constant.

getNestedTables

public java.util.ArrayList getNestedTables(java.sql.Connection conn)
                                    throws java.sql.SQLException
Description copied from interface: SQLBuilder
Returns a list of nested tables in this connection.

Note: this method is subject to change.

Specified by:
getNestedTables in interface SQLBuilder
Overrides:
getNestedTables in class BaseSQLBuilderImpl
Parameters:
conn - the connection.
Returns:
null if the platform doesn't support nested tables.
Throws:
java.sql.SQLException

getPersistManagerClassName

public java.lang.String getPersistManagerClassName()
Description copied from interface: SQLBuilder
Returns the name of default PersistManager class name.

Specified by:
getPersistManagerClassName in interface SQLBuilder
Specified by:
getPersistManagerClassName in class BaseSQLBuilderImpl
Returns:
a String containing the Class name.

getDefaultBindingStyle

public int getDefaultBindingStyle()
Default binding style for this SQLBuilder is Oracle Named parameters.

Specified by:
getDefaultBindingStyle in interface SQLBuilder
Overrides:
getDefaultBindingStyle in class BaseSQLBuilderImpl
Returns:
a SQLBuilder.BINDING_STYLE_ORACLE_NAME constant.

executeBatch

public void executeBatch(java.sql.PreparedStatement stmt)
                  throws java.sql.SQLException
Description copied from interface: SQLBuilder
Executes the PreparedStatement in batch mode. Implemented for Oracle database only by invoking OraclePreparedStatement.executeBatch. Other database flavors throw an exception.

Note: this method is subject to change.

Specified by:
executeBatch in interface SQLBuilder
Overrides:
executeBatch in class BaseSQLBuilderImpl
Parameters:
stmt - a PreparedStatement object.
Throws:
java.sql.SQLException

doEntityDML

public void doEntityDML(EntityImpl entityContext,
                        int operation,
                        TransactionEvent e)
Description copied from interface: SQLBuilder
Performs the appropriate SQL Data Manipulation Language (DML) operations on the database to reflect an update, delete or insert operation on an Entity Object.

Note: this method is subject to change.

Specified by:
doEntityDML in interface SQLBuilder
Overrides:
doEntityDML in class BaseSQLBuilderImpl
Parameters:
entityContext - the Entity Object.
operation - one of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - the transaction.

doEntitySelectForAltKey

public void doEntitySelectForAltKey(EntityImpl entityContext,
                                    int keyIndex,
                                    boolean lock)
Specified by:
doEntitySelectForAltKey in interface SQLBuilder
Overrides:
doEntitySelectForAltKey in class BaseSQLBuilderImpl

doStatementSetRowPrefetch

public void doStatementSetRowPrefetch(java.sql.Statement ps,
                                      int prefetchSize)
                               throws java.sql.SQLException
Description copied from interface: SQLBuilder
Performs the equivalent of setRowPrefetch() on a statement.

Specified by:
doStatementSetRowPrefetch in interface SQLBuilder
Overrides:
doStatementSetRowPrefetch in class BaseSQLBuilderImpl
Parameters:
ps - the Statement object.
prefetchSize - the fetch size.
Throws:
java.sql.SQLException

doStatementSetBindingStyle

public void doStatementSetBindingStyle(java.sql.Statement ps,
                                       int bindingStyle)
Description copied from interface: SQLBuilder
Sets the binding style for the statement.

Specified by:
doStatementSetBindingStyle in interface SQLBuilder
Overrides:
doStatementSetBindingStyle in class BaseSQLBuilderImpl
Parameters:
ps - the Statement object.
bindingStyle - valid values are BINDING_STYLE_JDBC, BINDING_STYLE_ORACLE, BINDING_STYLE_ORACLE_NAME.

doStatementSetBindingStyleDefault

public void doStatementSetBindingStyleDefault(java.sql.Statement ps)
Description copied from interface: SQLBuilder
Sets the binding style to the default value of the database type. For Oracle database it is set to BINDING_STYLE_ORACLE and for non-oracle databases it is set to BINDING_STYLE_JDBC.

Note: this method is subject to change.

Specified by:
doStatementSetBindingStyleDefault in interface SQLBuilder
Overrides:
doStatementSetBindingStyleDefault in class BaseSQLBuilderImpl
Parameters:
ps - the Statement object.

doPreparedStatementDefineColumnType

public void doPreparedStatementDefineColumnType(java.sql.PreparedStatement ps,
                                                int colnum,
                                                int sqltype)
                                         throws java.sql.SQLException
Description copied from interface: SQLBuilder
Performs the equivalent of defineColumnType() on a prepared statement.

Note: this method is subject to change.

Specified by:
doPreparedStatementDefineColumnType in interface SQLBuilder
Overrides:
doPreparedStatementDefineColumnType in class BaseSQLBuilderImpl
Parameters:
ps - the PreparedStatement object.
colnum - the column number.
sqltype - the type of the column.
Throws:
java.sql.SQLException

doPreparedStatementDefines

public void doPreparedStatementDefines(java.sql.PreparedStatement stmt,
                                       AttributeDefImpl[] columns)
Description copied from interface: SQLBuilder
Defines the column types of the attributes based on the meta-data.

Note: this method is subject to change.

Specified by:
doPreparedStatementDefines in interface SQLBuilder
Overrides:
doPreparedStatementDefines in class BaseSQLBuilderImpl
Parameters:
stmt - the PreparedStatement object.
columns - the attribute definitions.

doLoadFromResultSet

public java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory,
                                            java.lang.Object theElemFactory,
                                            java.lang.Class theJavaType,
                                            byte attrLoad,
                                            java.sql.ResultSet rs,
                                            int index,
                                            DBTransactionImpl trans)
Description copied from interface: SQLBuilder
Loads an object from a result set.

Note: this method is subject to change.

Specified by:
doLoadFromResultSet in interface SQLBuilder
Overrides:
doLoadFromResultSet in class BaseSQLBuilderImpl
Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
theElemFactory - currently unused.
theJavaType - the Java datatype of the Object to be created.
attrLoad - specifies if the load type is ATTR_LOAD_EACH, ATTR_LOAD_BULK or ATTR_LOAD_SKIP
rs - the resultset.
index - the index of the object to be loaded.
trans - the reference to the transaction object used to fetch the resultset.
Returns:
a reference to the object loaded.

doLoadBulkFromResultSet

public java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrDefs,
                                                  int attrIndex,
                                                  java.sql.ResultSet rs,
                                                  int index,
                                                  DBTransactionImpl trans)
Description copied from interface: SQLBuilder
Loads an array of objects from a result set.

Note: this method is subject to change.

Specified by:
doLoadBulkFromResultSet in interface SQLBuilder
Overrides:
doLoadBulkFromResultSet in class BaseSQLBuilderImpl
Parameters:
attrDefs - the list of attributes to be loaded.
attrIndex - a particular attribute from the list - Currently unused.
rs - the ResultSet containing the objects.
index - the index of the object in the result set to be loaded.
trans - the reference to the transaction object used to fetch the resultset.
Returns:
a reference to the array of objects loaded.

doLoadFromStatement

public java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory,
                                            java.lang.Object theElemFactory,
                                            java.lang.Class theJavaType,
                                            java.sql.PreparedStatement ps,
                                            int index,
                                            Transaction trans)
Description copied from interface: SQLBuilder
Loads an object from a result set.

Note: this method is subject to change.

Specified by:
doLoadFromStatement in interface SQLBuilder
Overrides:
doLoadFromStatement in class BaseSQLBuilderImpl
Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
theElemFactory - currently unused.
theJavaType - the Java datatype of the Object to be created.
ps - the statement reference used to retrieve the Object.
index - the index of the object in the output list.
trans - the reference to the transaction object used to fetch the resultset.
Returns:
a reference to the object loaded.

setSavepoint

public void setSavepoint(java.sql.Connection conn,
                         java.lang.String id)
                  throws java.sql.SQLException
Description copied from interface: SQLBuilder
Issue a SAVEPOINT if possible.

Specified by:
setSavepoint in interface SQLBuilder
Overrides:
setSavepoint in class BaseSQLBuilderImpl
Parameters:
conn - the Connection used to create a savepoint.
id - the id for a savepoint.
Throws:
java.sql.SQLException

rollbackToSavepoint

public void rollbackToSavepoint(java.sql.Connection conn,
                                java.lang.String id)
                         throws java.sql.SQLException
Description copied from interface: SQLBuilder
Rollback to SAVEPOINT if possible.

Specified by:
rollbackToSavepoint in interface SQLBuilder
Overrides:
rollbackToSavepoint in class BaseSQLBuilderImpl
Parameters:
conn - the Connection used to rollback the savepoint.
id - the id for a savepoint
Throws:
java.sql.SQLException

releaseSavepoint

public void releaseSavepoint(java.sql.Connection conn,
                             java.lang.String id)
                      throws java.sql.SQLException
Description copied from interface: SQLBuilder
Release SAVEPOINT if possible.

Specified by:
releaseSavepoint in interface SQLBuilder
Overrides:
releaseSavepoint in class BaseSQLBuilderImpl
Parameters:
conn - the Connection used to release the savepoint.
id - the id for a savepoint
Throws:
java.sql.SQLException

supportsReturningClause

public boolean supportsReturningClause()
Oracle database supports RETURNING clause.

Specified by:
supportsReturningClause in interface SQLBuilder
Overrides:
supportsReturningClause in class BaseSQLBuilderImpl
Returns:
true.

supportsRowNumQuery

public boolean supportsRowNumQuery()
Oracle database supports rownum in a query.

Specified by:
supportsRowNumQuery in interface SQLBuilder
Overrides:
supportsRowNumQuery in class BaseSQLBuilderImpl
Returns:
true.

buildRangePagingQuery

public java.lang.String buildRangePagingQuery(ViewObjectImpl vo,
                                              java.lang.String qry,
                                              int noUserParams)
Specified by:
buildRangePagingQuery in interface SQLBuilder
Overrides:
buildRangePagingQuery in class BaseSQLBuilderImpl

bindRangePagingParams

public void bindRangePagingParams(java.sql.PreparedStatement stmt,
                                  ViewObjectImpl vo,
                                  int nextParamIndex,
                                  int rangeStart,
                                  int rangeSize)
Specified by:
bindRangePagingParams in interface SQLBuilder
Overrides:
bindRangePagingParams in class BaseSQLBuilderImpl

buildUpdateStatement

public java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)
Description copied from interface: SQLBuilder
Build a UPDATE SQL for the Entity Object skipping non-persistent values. If there are attributes in the Entity Object that need to be fetched after the UPDATE succeeds, a CallableStatement is created to fetch those values.

Note: this method is subject to change.

Specified by:
buildUpdateStatement in interface SQLBuilder
Overrides:
buildUpdateStatement in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
cols - the columns to be included in the UPDATE statement.
retrCols - the Columns whose values need to be fetched after the UPDATE succeeds.
retrKeyCols - the Columns that are used as Keys to fetch post-update values.
batchMode - a flag to indicate if the UPDATE statement needs to be optimized for batch mode.
Returns:
a StringBuffer object containing the UPDATE statement.

buildReturningClause

protected void buildReturningClause(java.lang.StringBuffer sqlBuffer,
                                    DBTransactionImpl trans,
                                    AttributeDefImpl[] retrCols,
                                    AttributeDefImpl[] retrKeyCols,
                                    boolean batchMode,
                                    boolean oracleBinding)
Create a statement to use the RETURNING clause for the entity attributes that need to be fetched after a successful INSERT or UPDATE. If using the RETURNING clause is not feasible a Callable Statement with two SQL Statements is used. RETURNING clause is not generated for batch mode.

Parameters:
sqlBuffer - the StringBuffer object to which the RETURNING clause is appended.
trans - the transaction object
retrCols - the Columns whose values need to be fetched after the entity DML succeeds.
retrKeyCols - the Columns that are used as Keys to fetch the values.
batchMode - indicates if the SQL is being generated for batch mode.
oracleBinding - indicates the binding style to use.

bindInsertStatement

public int bindInsertStatement(EntityImpl entityContext,
                               java.sql.PreparedStatement stmt,
                               AttributeDefImpl[] cols,
                               AttributeDefImpl[] retrCols,
                               AttributeDefImpl[] retrKeyCols,
                               java.util.HashMap retrList,
                               boolean batchMode)
                        throws java.sql.SQLException
Description copied from interface: SQLBuilder
Binds the entity attribute storage with the parameters in the INSERT statement.

Note: this method is subject to change.

Specified by:
bindInsertStatement in interface SQLBuilder
Overrides:
bindInsertStatement in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
stmt - the statement handle executing the INSERT statement.
cols - the columns involved in the INSERT statement.
retrCols - the columns whose values need to be fetched after a successful insert.
retrKeyCols - the columns that act as a key to fetch the newly inserted values.
retrList - a map containing the references to store the fetched values.
batchMode - flag to indicate binding for batchMode.
Returns:
index of last bind variable set in this statement.
Throws:
java.sql.SQLException

bindUpdateStatement

public int bindUpdateStatement(EntityImpl entityContext,
                               java.sql.PreparedStatement stmt,
                               AttributeDefImpl[] cols,
                               AttributeDefImpl[] retrCols,
                               AttributeDefImpl[] retrKeyCols,
                               java.util.HashMap retrList,
                               boolean batchMode)
                        throws java.sql.SQLException
Description copied from interface: SQLBuilder
Binds the entity attribute storage with the parameters in the UPDATE statement.

Note: this method is subject to change.

Specified by:
bindUpdateStatement in interface SQLBuilder
Overrides:
bindUpdateStatement in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
stmt - the statement handle executing the UPDATE statement.
cols - the columns involved in the UPDATE statement.
retrCols - the columns whose values need to be fetched after a successful insert.
retrKeyCols - the columns that act as a key to fetch the newly inserted values.
retrList - a map containing the references to store the fetched values.
batchMode - flag to indicate binding for batchMode.
Returns:
index of last bind variable set in this statement.
Throws:
java.sql.SQLException

bindWhereAttrValue

protected int bindWhereAttrValue(EntityImpl entityContext,
                                 DBTransactionImpl trans,
                                 java.sql.PreparedStatement stmt,
                                 AttributeDefImpl attrDef,
                                 int bindIndex,
                                 boolean skipNull)
                          throws java.sql.SQLException
Description copied from class: BaseSQLBuilderImpl
Binds an attribute value to the Statement's WHERE clause parameter index dealing with Null values appropriately. The attribute value is not yet poupulated in the Entity definition it is fetched and then bound.

Overrides:
bindWhereAttrValue in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
trans - the transaction object.
stmt - the Statement object carrying out the SQL.
attrDef - the defintion of the attribute to which the value belongs.
bindIndex - the parameter index in the PreparedStatement.
skipNull - indicates if the null values need to be bound or skipped.
Returns:
a new bind index value so that this method can be invoked in a loop.
Throws:
java.sql.SQLException

getROWID

protected java.lang.Object getROWID(EntityImpl entityContext)
Description copied from class: BaseSQLBuilderImpl
Get the ROWID attribute. The ROWID attribute can be used to gain faster access to the underyling database data. Obtain the value for the ROWID attribute. If this entity doesn't support ROWID attributes, then return NULL. If, for some reason the value of the ROWID attribute isn't present, then return null.

Overrides:
getROWID in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
Returns:
the value of the ROWID attribute or null if not present or applicable to this entity.

buildWhereClause

public void buildWhereClause(EntityImpl entityContext,
                             java.lang.StringBuffer buffer,
                             AttributeDefImpl[] keyCols,
                             java.lang.Object rowid)
Description copied from interface: SQLBuilder
Creates a WHERE clause containing the Primary Key columns passed to the method.

Note: this method is subject to change.

Specified by:
buildWhereClause in interface SQLBuilder
Overrides:
buildWhereClause in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
buffer - the StringBuffer object to which the WHERE clause is appended.
keyCols - the key attributes.
rowid - a rowid object if present.

buildOptUpdateWhereClause

public void buildOptUpdateWhereClause(EntityImpl entityContext,
                                      java.lang.StringBuffer buffer,
                                      AttributeDefImpl[] cols)
Description copied from class: BaseSQLBuilderImpl
This method binds the unfetched attributes in the list or the change indicator column of an entity definition.

Overrides:
buildOptUpdateWhereClause in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity definition.
buffer - the storage for the WHERE clause.
cols - the attributes to be considered for fetching.

buildInsertStatement

public java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)
Description copied from interface: SQLBuilder
Build a INSERT SQL for the Entity Object skipping non-persistent values. If there are attributes in the Entity Object that need to be fetched after the INSERT succeeds, a CallableStatement is created to fetch those values.

Note: this method is subject to change.

Specified by:
buildInsertStatement in interface SQLBuilder
Overrides:
buildInsertStatement in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
cols - the columns to be included in the INSERT statement.
retrCols - the Columns whose values need to be fetched after the INSERT succeeds.
retrKeyCols - the Columns that are used as Keys to fetch post-insert values.
batchMode - a flag to indicate if the INSERT statement needs to be optimized for batch mode.
Returns:
a StringBuffer object containing the INSERT statement.

buildDeleteStatement

public java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
Description copied from interface: SQLBuilder
Build a DELETE SQL for the Entity Object. The row is deleted from the table using the values of the Primary keys defined in the Entity.

Note: this method is subject to change.

Specified by:
buildDeleteStatement in interface SQLBuilder
Overrides:
buildDeleteStatement in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object.
Returns:
a StringBuffer object containing the UPDATE statement.

buildSelectString

public void buildSelectString(DBTransactionImpl trans,
                              java.lang.StringBuffer buffer,
                              java.lang.String sourceName,
                              java.lang.String sourceAlias,
                              AttributeDefImpl[] attrs,
                              boolean withIntoClause,
                              int bindingStyle)
Build a list of columns that could be used in a SELECT statement.

Note: this method is subject to change.

Specified by:
buildSelectString in interface SQLBuilder
Overrides:
buildSelectString in class BaseSQLBuilderImpl
Parameters:
buffer - the StringBuffer object to which the SELECT list is appended.
attrs - the list of attribute definitions to be considered for the SELECT list.
sourceName - the database object name that contains the attributes.
trans - a reference to the transaction object.
sourceAlias - the database object alias.
withIntoClause - a boolean that indicates if an INTO Clause needs to be generated.
bindingStyle - specifies if Oracle, Oracle named parameter or JDBC binding style is used in generating the parameter markers for the INTO clause.

generatePKBasedRef

public java.lang.Object generatePKBasedRef(EntityImpl entityContext)
Description copied from interface: SQLBuilder
Generates a PK-Based REF for an Entity Object. This is used for an object table.

Note: this method is subject to change.

Specified by:
generatePKBasedRef in interface SQLBuilder
Overrides:
generatePKBasedRef in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object reference.

generateRefAndOID

public java.lang.Object[] generateRefAndOID(EntityImpl entityContext)
Description copied from interface: SQLBuilder
Generates an object Ref and OID for an Entity Object. This is used for an object table.

Note: this method is subject to change.

Specified by:
generateRefAndOID in interface SQLBuilder
Overrides:
generateRefAndOID in class BaseSQLBuilderImpl
Parameters:
entityContext - the entity object reference.

isStreamType

public boolean isStreamType(int sqlTypeId)
Description copied from interface: SQLBuilder
Check if a given type provides streaming support.

Note: this method is subject to change.

Specified by:
isStreamType in interface SQLBuilder
Overrides:
isStreamType in class BaseSQLBuilderImpl
Parameters:
sqlTypeId - the type to check for streaming support.

getSchemaList

public java.util.Vector getSchemaList(java.sql.Connection connection)
                               throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of schemas for this database (note that for Oracle this is synonymous with users)

Note: this method is subject to change.

Specified by:
getSchemaList in interface SQLBuilder
Overrides:
getSchemaList in class BaseSQLBuilderImpl
Returns:
a Vector containing String objects.
Throws:
java.lang.Exception

getTables

public java.util.ArrayList getTables(java.sql.Connection conn,
                                     java.lang.String defaultUserName,
                                     java.lang.String userName,
                                     boolean bTable,
                                     boolean bAlias,
                                     boolean bView,
                                     boolean bSnap)
                              throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of tables visible in this connection. Same as getTables(Connection, String, String, String, boolean, boolean, boolean, boolean) with no filter on the table name.

Note: this method is subject to change.

Specified by:
getTables in interface SQLBuilder
Overrides:
getTables in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Materialized View objects in the list.
Returns:
an ArrayList containing String objects.
Throws:
java.lang.Exception

getTables

public java.util.ArrayList getTables(java.sql.Connection conn,
                                     java.lang.String defaultUserName,
                                     java.lang.String userName,
                                     java.lang.String nameFilter,
                                     boolean bTable,
                                     boolean bAlias,
                                     boolean bView,
                                     boolean bSnap)
                              throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of tables visible in this connection.

Note: this method is subject to change.

Specified by:
getTables in interface SQLBuilder
Overrides:
getTables in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
nameFilter - the filter for the name of the table to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Materialized View objects in the list.
Returns:
an ArrayList containing String objects.
Throws:
java.lang.Exception

getTables

public java.util.ArrayList getTables(java.sql.Connection conn,
                                     java.lang.String defaultUserName,
                                     java.lang.String userName,
                                     boolean bTable,
                                     boolean bAlias,
                                     boolean bView,
                                     boolean bSnap,
                                     boolean bIncludeNested)
                              throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of tables visible in this connection. Same as getTables(Connection, String, String, String, boolean, boolean, boolean, boolean) with no filter on the table name and an additional parameter to fetch nested tables. Nested tables are fetched only for Oracle database and OLite.

Note: this method is subject to change.

Specified by:
getTables in interface SQLBuilder
Overrides:
getTables in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Materialized View objects in the list.
bIncludeNested - flag to include Nested table objects in the list.
Returns:
an ArrayList containing String objects.
Throws:
java.lang.Exception

getTables

public java.util.ArrayList getTables(java.sql.Connection conn,
                                     java.lang.String defaultUserName,
                                     java.lang.String userName,
                                     java.lang.String nameFilter,
                                     boolean bTable,
                                     boolean bAlias,
                                     boolean bView,
                                     boolean bSnap,
                                     boolean bIncludeNested)
                              throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of tables visible in this connection. Same as getTables(Connection, String, String, String, boolean, boolean, boolean, boolean) with an additional parameter to fetch nested tables. Nested tables are fetched only for Oracle database and OLite.

Note: this method is subject to change.

Specified by:
getTables in interface SQLBuilder
Overrides:
getTables in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
nameFilter - the filter for the name of the table to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Materialized View objects in the list.
bIncludeNested - flag to include Nested table objects in the list.
Returns:
an ArrayList containing String objects.
Throws:
java.lang.Exception

getDBPackageList

public java.util.ArrayList getDBPackageList(java.sql.Connection connection,
                                            java.lang.String userName,
                                            java.lang.String packageFilter)
                                     throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of packages visible in this connection. Invokes getDBPackageList(Connection conn, String userName).

Note: this method is subject to change.

Specified by:
getDBPackageList in interface SQLBuilder
Overrides:
getDBPackageList in class BaseSQLBuilderImpl
Parameters:
connection - the connection object.
userName - the user name for which database packages need to be listed.
packageFilter - the filter the database packages need to be listed.
Returns:
a ArrayList containing String objects.
Throws:
java.lang.Exception

getDBOperationList

public java.util.ArrayList getDBOperationList(java.sql.Connection connection,
                                              java.lang.String userName,
                                              java.lang.String packageFilter,
                                              java.lang.String operationFilter)
                                       throws java.lang.Exception
Description copied from interface: SQLBuilder
Return a list of packages visible in this connection.

Note: this method is subject to change.

Specified by:
getDBOperationList in interface SQLBuilder
Overrides:
getDBOperationList in class BaseSQLBuilderImpl
Parameters:
connection - the connection object.
userName - the user name for which the database functions and procedures need to be listed.
packageFilter - the filter the database packages in which the functions and procedures need to be listed.
operationFilter - the filter the database functions and procedures need to be listed.
Returns:
a ArrayList containing String objects.
Throws:
java.lang.Exception

needsQuotedTableName

protected boolean needsQuotedTableName(java.lang.String tableName)
Description copied from class: BaseSQLBuilderImpl
Inspects the table name if it needs to be escaped with quotes.

Overrides:
needsQuotedTableName in class BaseSQLBuilderImpl
Parameters:
tableName - the table name.
Returns:
true if quotes are needed, false otherwise.

getTableListSqlStatement

protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName,
                                                           java.lang.String userName,
                                                           boolean bTable,
                                                           boolean bAlias,
                                                           boolean bView,
                                                           boolean bSnap,
                                                           boolean bCount)
A helper method for getTableList. Generates the SQL statement for selecting different object types from the database.

Parameters:
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Snapshot objects in the list.
bCount - flag to retrieve the number of objects that will be fetched based on the object type flags.
Returns:
a SQL Statement that could be used to fetch the list of objects from the database.

getTableListSqlStatement

protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName,
                                                           java.lang.String userName,
                                                           boolean bTable,
                                                           boolean bAlias,
                                                           boolean bView,
                                                           boolean bSnap,
                                                           boolean bCount,
                                                           boolean bIncludeNested)
A helper method for getTableList. Generates the SQL statement for selecting different object types from the database.

Parameters:
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Snapshot objects in the list.
bCount - flag to retrieve the number of objects that will be fetched based on the object type flags.
bIncludeNested - flag to include nested tables.
Returns:
a SQL Statement that could be used to fetch the list of objects from the database.

getTableListSqlStatement

protected static java.lang.String getTableListSqlStatement(java.lang.String defaultUserName,
                                                           java.lang.String userName,
                                                           java.lang.String nameFilter,
                                                           boolean bTable,
                                                           boolean bAlias,
                                                           boolean bView,
                                                           boolean bSnap,
                                                           boolean bCount,
                                                           boolean bIncludeNested)
A helper method for getTableList. Generates the SQL statement for selecting different object types from the database.

Parameters:
defaultUserName - the user name of the connection. This is will also be treated as the schema name for non-oracle databases.
userName - the user name for which the tables need to be listed.
nameFilter - the filter of the name for which the tables need to be listed.
bTable - flag to include Table objects in the list.
bAlias - flag to include Synonyms in the list - Oracle database only.
bView - flag to include View objects in the list.
bSnap - flag to include Snapshot objects in the list.
bCount - flag to retrieve the number of objects that will be fetched based on the object type flags.
bIncludeNested - flag to include nested tables.
Returns:
a SQL Statement that could be used to fetch the list of objects from the database.

addSqlTypeText

protected static java.lang.String addSqlTypeText(java.lang.String sqlText,
                                                 java.lang.String inputType)
A helper method for getTableList. Adds a clause to select a different object type to the list.

Parameters:
sqlText - a String containing a list of object types included so far.
inputType - a new object type to be added to the list.
Returns:
an updated object type list.

getConstraintsList

public java.util.ArrayList getConstraintsList(java.sql.Connection conn,
                                              java.lang.String catalog,
                                              java.lang.String schema,
                                              java.lang.String table)
                                       throws java.sql.SQLException
Description copied from interface: SQLBuilder
Return vector with constraint details for this table where each detail is in a String array with this structure: 0 String owner

1 String constraint_name

2 String constraint_type

3 String table_name

4 String search_condition

5 Integer delete_rule (cascade)

6 Integer status (enabled)

7 Integerdeferrable

8 Integer deferred

9 Integer validated

10 String column_name

11 Integer position

12 String fkname

13 String fkother

Note: this method is subject to change.

Specified by:
getConstraintsList in interface SQLBuilder
Overrides:
getConstraintsList in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
catalog - the database catalog.
schema - the database schema.
table - the name of the table.
Returns:
an ArrayList containing an array of String objects.
Throws:
java.sql.SQLException

getBaseTable

public java.lang.String getBaseTable(java.sql.Connection conn,
                                     java.lang.String schema,
                                     java.lang.String name)
                              throws java.sql.SQLException
Description copied from interface: SQLBuilder
Unroll any synonyms that may be present, and get the real objectname.

Note: this method is subject to change.

Specified by:
getBaseTable in interface SQLBuilder
Overrides:
getBaseTable in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
schema - the database schema.
name - the name of the potential synonym.
Returns:
a String containing the real table name. Note that even if the argument is a table name it may be altered to enforce consistent naming convention. For non-Oracle databases the name is returned unaltered.
Throws:
java.sql.SQLException

getJDBCDriverClassName

protected java.lang.String getJDBCDriverClassName(java.lang.String url)
Description copied from class: BaseSQLBuilderImpl
Concrete implementations of SQLBuilder must elect a default driver name.

Specified by:
getJDBCDriverClassName in class BaseSQLBuilderImpl
Parameters:
url - JDBC Connection url.
Returns:
the default driver class name based on the url and database flavor.

getFormattedRHSCompareFragment

public java.lang.String getFormattedRHSCompareFragment(ViewObject vo,
                                                       ViewCriteria vc,
                                                       AttributeDef attrDef,
                                                       int sqlType,
                                                       java.lang.String rhs)
Description copied from class: BaseSQLBuilderImpl
Override this method to provide a formatted right-hand-comparator fragment of a comparision in a where clause for the given column.

Specified by:
getFormattedRHSCompareFragment in interface SQLBuilder
Overrides:
getFormattedRHSCompareFragment in class BaseSQLBuilderImpl
Parameters:
vo - the view object definition.
vc - the view criteria definition.
attrDef - the definition of the attribute.
sqlType - the type of the attribute value.
rhs - the value of the attribute.
Returns:
a String containing the SQL fragment.

isDateOrTimeTypeVariable

protected boolean isDateOrTimeTypeVariable(Variable var)

getFormattedLHSCompareFragment

public java.lang.String getFormattedLHSCompareFragment(ViewObject vo,
                                                       ViewCriteria vc,
                                                       AttributeDef attrDef,
                                                       int sqltype,
                                                       java.lang.String lhs,
                                                       java.lang.Object rhs)
Description copied from interface: SQLBuilder
This method provides a formatted left-hand-comparator fragment of a comparision in a where clause for the given column.

Specified by:
getFormattedLHSCompareFragment in interface SQLBuilder
Overrides:
getFormattedLHSCompareFragment in class BaseSQLBuilderImpl
Parameters:
vo - the view object instance, could be null if unavailable in the context
vc - the view criteria instance, could be null if unavailable in the context
attrDef - the definition of the attribute.
sqltype - the type of the attribute value.
rhs - the value of the attribute.
Returns:
a String containing the SQL fragment.

getSqlVariantLockTrailer

protected java.lang.String getSqlVariantLockTrailer(EntityImpl entityContext)
Invokes the default getSqlVariantLockTrailer() method.

Parameters:
entityContext - - currently unused.
Returns:
the row locking clause.

getSqlVariantLockTrailer

protected java.lang.String getSqlVariantLockTrailer()
Description copied from class: BaseSQLBuilderImpl
This defines the string that will be post-fixed to SQL statements to have the rows locked - if the DB is incapable of this then it should return null. Examples are: SQL Server - "WITH (HOLDLOCK)" Oracle - "FOR UPDATE NOWAIT"

Overrides:
getSqlVariantLockTrailer in class BaseSQLBuilderImpl
Returns:
the lock clause.

getDbTimeQuery

public java.lang.String getDbTimeQuery()
Description copied from class: BaseSQLBuilderImpl
Returns a SQL statement to obtain the current time from the database.

Specified by:
getDbTimeQuery in class BaseSQLBuilderImpl
Returns:
a String containing the SQL statement.

getDropTableSQL

public java.lang.String getDropTableSQL(java.lang.String dbObjectName)
Description copied from interface: SQLBuilder
Returns a SQL statement that drops a specified table. For Oracle database it also deletes the constraints for the table.

Note: this method is subject to change.

Specified by:
getDropTableSQL in interface SQLBuilder
Specified by:
getDropTableSQL in class BaseSQLBuilderImpl
Parameters:
dbObjectName - name of the Table.
Returns:
the SQL statement as a String object.

isDisplayBindValueUI

public boolean isDisplayBindValueUI()
Description copied from interface: SQLBuilder
For Oracle database the test SQL wizards provide additional functionality to bind the parameters with test values. For other databases this functionality is not supported.

Specified by:
isDisplayBindValueUI in interface SQLBuilder
Specified by:
isDisplayBindValueUI in class BaseSQLBuilderImpl
Returns:
true for Oracle, false for all other databases.

getCreateSequenceInsertTriggerSQL

public java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName,
                                                          java.lang.String tableName,
                                                          java.util.ArrayList sequenceNames,
                                                          java.util.ArrayList colNames)
Description copied from interface: SQLBuilder
Returns a SQL statement that creates a trigger that updates a column with the value from a sequence upon the creation of a new row.

Supported for Oracle database only.

Note: this method is subject to change.

Specified by:
getCreateSequenceInsertTriggerSQL in interface SQLBuilder
Specified by:
getCreateSequenceInsertTriggerSQL in class BaseSQLBuilderImpl
Parameters:
triggerName - the name of the trigger.
tableName - the name of the table for which the trigger is created.
sequenceNames - the array of names of the sequence.
colNames - the arrya of names of the column to which the value of the sequence is copied to.
Returns:
the SQL statement as a String object.

getCreateSequenceSQL

public java.lang.String getCreateSequenceSQL(java.lang.String sequenceName,
                                             int startVal)
Description copied from interface: SQLBuilder
Returns a SQL statement that creates a Sequence with an initial value specified in the argument.

Note: this method is subject to change.

Specified by:
getCreateSequenceSQL in interface SQLBuilder
Specified by:
getCreateSequenceSQL in class BaseSQLBuilderImpl
Parameters:
sequenceName - name of the Sequence.
startVal - the initial value of the Sequence.
Returns:
the SQL statement as a String object.

getDropSequenceSQL

public java.lang.String getDropSequenceSQL(java.lang.String sequenceName)
Description copied from interface: SQLBuilder
Returns a SQL statement that drops a specified Sequence.

Note: this method is subject to change.

Specified by:
getDropSequenceSQL in interface SQLBuilder
Specified by:
getDropSequenceSQL in class BaseSQLBuilderImpl
Parameters:
sequenceName - name of the Sequence.
Returns:
the SQL statement as a String object.

isConnectionAlive

public boolean isConnectionAlive(java.sql.Connection conn)
Description copied from interface: SQLBuilder
Detects if a connection is alive.

Specified by:
isConnectionAlive in interface SQLBuilder
Overrides:
isConnectionAlive in class BaseSQLBuilderImpl
Parameters:
conn - the connection object.
Returns:
true if the connection is active, false otherwise.

convertValueToStorageType

public java.lang.Object convertValueToStorageType(java.lang.Object value)
Description copied from interface: SQLBuilder
This method is used to convert the Java type to a JDBC type so that it could be used to bind as a parameter for SQL execution.

Note: this method is subject to change.

Specified by:
convertValueToStorageType in interface SQLBuilder
Overrides:
convertValueToStorageType in class BaseSQLBuilderImpl
Parameters:
value - the object that needs to be converted.
Returns:
the JDBC type.

jdbcClientSideSecurity

public void jdbcClientSideSecurity(java.util.Properties info,
                                   java.util.Hashtable env)
Description copied from interface: SQLBuilder
Populates the properties with known security attributes found in the environment. Used for Oracle JDBC connectivity only. The values are copied into the Properties from the Session's environment.

Note: this method is subject to change.

Specified by:
jdbcClientSideSecurity in interface SQLBuilder
Overrides:
jdbcClientSideSecurity in class BaseSQLBuilderImpl
Parameters:
info - the properties object to which the values are copied to.
env - the environment object to lookup the security attributes.

compareFetchedValue

public boolean compareFetchedValue(EntityImpl entity,
                                   AttributeDefImpl ad,
                                   java.lang.Object cacheValue,
                                   java.lang.Object fetchedValue)
Overridden for Oracle because in OracleDB, in cache we may have "" string that was posted and DB assumes that string as null and returns null on fetch again. This method should return true for such cases.

Specified by:
compareFetchedValue in interface SQLBuilder
Overrides:
compareFetchedValue in class BaseSQLBuilderImpl
Parameters:
entity - the entity object.
ad - the attribute definition of the value being compared.
cacheValue - the cached value.
fetchedValue - the new fetched value.
Returns:
true if the values are same, false otherwise.

bindParamValue

protected int bindParamValue(int bindingStyle,
                             java.lang.Object value,
                             DBTransactionImpl trans,
                             java.sql.PreparedStatement stmt,
                             AttributeDefImpl attrDef,
                             int bindIndex,
                             boolean skipNull)
                      throws java.sql.SQLException
Description copied from class: BaseSQLBuilderImpl
Binds a parameter value to the Statement's bind index dealing with Null values appropriately.

Overrides:
bindParamValue in class BaseSQLBuilderImpl
Parameters:
bindingStyle - one of the SQLBuilder binding style constants.
value - the object value to bind.
trans - the transaction object.
stmt - the Statement object carrying out the SQL.
attrDef - the defintion of the attribute to which the value belongs.
bindIndex - the parameter index in the PreparedStatement.
skipNull - indicates if the null values need to be bound or skipped.
Returns:
a new bind index value so that this method can be invoked in a loop.
Throws:
java.sql.SQLException

processException

public void processException(java.lang.String errorCode,
                             java.lang.Exception sqlEx,
                             java.lang.Object[] params)
Description copied from interface: SQLBuilder
Handle SQL exceptions by wrapping into SQLStmtException or JboException.

Note: this method is subject to change.

Specified by:
processException in interface SQLBuilder
Overrides:
processException in class BaseSQLBuilderImpl
Parameters:
errorCode - the SQL execution errorcode.
sqlEx - the Exception object.
params - the query parameters.

invalidDatumFactoryUsage

public boolean invalidDatumFactoryUsage(java.lang.String colType,
                                        int id,
                                        java.lang.Class clz)
Returns false only for types where raw-bytes may be used to create the desired attribute values while fetching data from jdbc.

Specified by:
invalidDatumFactoryUsage in interface SQLBuilder
Overrides:
invalidDatumFactoryUsage in class BaseSQLBuilderImpl

buildDefaultViewObjectFromClause

public void buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause,
                                             java.util.List eRefs,
                                             BaseViewCriteriaManagerImpl vcManager)
Description copied from interface: SQLBuilder
This method is used to generate the "from" clause if the following conditions are met:
  • The View Object definition does not have an expert mode query
  • The View Object definition is set to generate "from" clause during runtime, either in metadata or by calling ViewDefImpl.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
  • Specified by:
    buildDefaultViewObjectFromClause in interface SQLBuilder
    Overrides:
    buildDefaultViewObjectFromClause in class BaseSQLBuilderImpl
    Parameters:
    fromClause - A StringBuffer object that would be appended with the generated "from" clause.
    eRefs - The EntityReference objects that should be considered for generation of the "from" clause.
    vcManager - In ANSI generation, view criteria associated with the EntityAssociationReference are part of the FROM clause, and vcManager is used to build the where clause fragment. if NULL, view criteria won't be built

    shouldPutJoinConstraintInFromClause

    public boolean shouldPutJoinConstraintInFromClause()
    Description copied from interface: SQLBuilder
    Checks if the FROM clause allows view criteria. In ANSI SQL generation, join constraint view criteria are part of the ON clause.

    Specified by:
    shouldPutJoinConstraintInFromClause in interface SQLBuilder
    Overrides:
    shouldPutJoinConstraintInFromClause in class BaseSQLBuilderImpl
    Returns:
    false for Oracle database and true otherwise.

    buildDefaultViewObjectWhereClause

    public java.util.HashMap buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause,
                                                               java.util.List eRefs,
                                                               java.util.List forcedERefs,
                                                               EntityReference[][] newEntRefsArr,
                                                               boolean isInlineViewForFroms)
    Description copied from interface: SQLBuilder
    This method is used to generate the "where" clause if the following conditions are met:
  • The View Object definition does not specify "where" clause
  • The View Object definition is set to generate "where" clause during runtime, either in metadata or by calling ViewDefImpl.setWhereClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
  • Specified by:
    buildDefaultViewObjectWhereClause in interface SQLBuilder
    Overrides:
    buildDefaultViewObjectWhereClause in class BaseSQLBuilderImpl
    Parameters:
    whereClause - A StringBuffer object that would be appended with the generated "where" clause.
    eRefs - The EntityReference objects that should be considered for generation of the "where" clause.

    buildEffDtDateDayAddStatement

    public java.lang.String buildEffDtDateDayAddStatement()
    Description copied from interface: SQLBuilder
    Returns a statement that returns a date that is 'x' number of days apart from the specified date.

    Specified by:
    buildEffDtDateDayAddStatement in interface SQLBuilder
    Overrides:
    buildEffDtDateDayAddStatement in class BaseSQLBuilderImpl
    Returns:
    A String that contains the necessary SQL.

    getClauseForDateLiteral

    public java.lang.String getClauseForDateLiteral(java.util.Date date)
    Description copied from interface: SQLBuilder
    Creates a database platform specific clause for converting a date string literal to date datatype. May be used in date comparisions and other manipulations.

    Parameters:
    date - The date object that will be formatted and passed as a String
    Returns:
    A string representing the clause to be used while building the query statement.

    setSessionTimeZone

    public void setSessionTimeZone(java.sql.Connection conn,
                                   java.lang.String regionName)
    Description copied from interface: SQLBuilder
    Sets the user session timezone on the Connection object. It is used for accessing the Oracle Timestamp with time zone datatypes.

    Specified by:
    setSessionTimeZone in interface SQLBuilder
    Overrides:
    setSessionTimeZone in class BaseSQLBuilderImpl
    Parameters:
    conn - Connection object
    regionName - timezone region, for example: America/New_York

    registerDatabaseChangeListener

    public ADFDatabaseChangeListener registerDatabaseChangeListener(QueryCollection listener,
                                                                    java.sql.Connection conn,
                                                                    java.sql.Statement stmt)
    Description copied from interface: SQLBuilder
    Register a Query Collection to listen to database data change events. Currently this is available for Oracle database only.

    Specified by:
    registerDatabaseChangeListener in interface SQLBuilder
    Overrides:
    registerDatabaseChangeListener in class BaseSQLBuilderImpl
    Parameters:
    listener - The Query Collection that holds the qualifying rows
    conn - Connection object
    stmt - The SQL Statement that needs to be monitored for the database to trigger notifications.
    Returns:
    An object that represents a registration handle that could be used to unregister.

    isNCharType

    public boolean isNCharType(java.sql.Statement stmt,
                               int index)
    Description copied from interface: SQLBuilder
    Tests if the select statement at a given column index corresponds to an international character column. This method performs a valid check only for Oracle Database.

    Specified by:
    isNCharType in interface SQLBuilder
    Overrides:
    isNCharType in class BaseSQLBuilderImpl
    Parameters:
    stmt - A select statement that has been executed
    index - The position of the column to be tested for international character type

    Oracle Fusion Middleware Java API Reference for Oracle ADF Model
    11g Release 1 (11.1.1.6.0)

    E10653-07

    Copyright © 1997, 2011, Oracle. All rights reserved.