Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.server
Class BaseSQLBuilderImpl

java.lang.Object
  extended byoracle.jbo.server.BaseSQLBuilderImpl
All Implemented Interfaces:
SQLBuilder, ViewCriteriaAdapter
Direct Known Subclasses:
OLiteSQLBuilderImpl, OracleSQLBuilderImpl, SQL92SQLBuilderImpl

public abstract class BaseSQLBuilderImpl
extends java.lang.Object
implements SQLBuilder, ViewCriteriaAdapter

Internal: Applications should not use this interface.

Note: This interface is subject to change.

This interface is used by View Objects to construct SQL statements that create, retrieve, update and delete table rows based on the state of the cache.

Since:
JDeveloper 3.0

Field Summary
 
Fields inherited from interface oracle.jbo.server.SQLBuilder
BINDING_STYLE_JDBC, BINDING_STYLE_ORACLE, BINDING_STYLE_UNKNOWN, DML_DELETE, DML_INSERT, DML_UPDATE
 
Constructor Summary
BaseSQLBuilderImpl()
           
 
Method Summary
 int bindDeleteStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt)
           
 int bindInsertStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, com.sun.java.util.collections.HashMap retrList, boolean batchMode)
          DOCTD: Method declaration
 int bindOptUpdateWhereClause(EntityImpl entityContext, java.sql.PreparedStatement stmt, int bindIndex)
           
 int bindUpdateStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, com.sun.java.util.collections.HashMap retrList, boolean batchMode)
          DOCTD: Method declaration
protected  int bindWhereAttrValue(EntityImpl entityContext, DBTransactionImpl trans, java.sql.PreparedStatement stmt, AttributeDefImpl attrDef, int bindIndex, boolean skipNull)
           
 int bindWhereClause(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] keyCols, java.lang.Object rowid, int bindIndex)
           
 int bindWhereClause(EntityImpl entityContext, java.sql.PreparedStatement stmt, java.lang.Object rowid, int bindIndex)
          Bind the Primary key values for the designated Statement.
 java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
          Construct a SQL INSERT statement
 java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          Construct a SQL INSERT statement
 void buildOptUpdateWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] cols)
           
 void buildSelectString(DBTransactionImpl trans, java.lang.StringBuffer buffer, java.lang.String sourceName, java.lang.String sourceAlias, AttributeDefImpl[] attrs, boolean withIntoClause, int bindingStyle)
           
protected  void buildSelectString(java.lang.StringBuffer buffer, java.lang.String sourceName, AttributeDefImpl[] attrs, boolean withIntoClause)
          Construct a SQL SELECT statement for the Entity into the designated Buffer.
 java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
          DOCTD: Method declaration TODO: KM _ don't like the fact that this requires an entitydef
 void buildWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] keyCols, java.lang.Object rowid)
          Construct a SQL WHERE clause for the Entity into the designated Buffer, based upon the Source Columns.
protected  boolean capabilityCanReuseLockStatements()
           
 java.lang.String checkTableNameForQuotes(java.lang.String tableName)
          add quotes to any table name that may need it.
 boolean compareFetchedValue(EntityImpl entity, AttributeDefImpl ad, java.lang.Object cacheValue, java.lang.Object fetchedValue)
          Compare the cacheValue with fetchedValue and if they are equal return true This api is used when comparing cached entity with a faulted in entity.
protected  java.lang.String[] convertFlags(boolean bTable, boolean bAlias, boolean bView, boolean bSnap)
           
 java.lang.Object convertValueToStorageType(java.lang.Object value)
          Abstraction to allow domain types to be not converted if they're jdbc known types.
protected  java.lang.Object convertValueToWhereFragment(AttributeDef curDef, java.lang.String trimmedValue)
           
protected  java.lang.Object convertValueToWhereFragment(ViewObject vo, ViewCriteria vc, AttributeDef curDef, java.lang.String trimmedValue)
           
 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 doEntitySelect(EntityImpl entityContext, boolean lock)
          Perform the appropriate SQL operations to execute a select operation on an Entity Object.
 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 ps, AttributeDefImpl[] attrs)
          Performs the equivalent of clearDefines() on a prepared statement.
 void doRefreshSQL(EntityImpl entityContext, int operation, AttributeDefImpl[] columns, AttributeDefImpl[] retrKeyCols)
           
 void doRegisterDefaultDriver()
          Registers the JDBC driver associated with this type of JDBC connection.
 void doStatementSetBindingStyle(java.sql.Statement ps, int bindingStyle)
          Sets the binding style for the statement.
 void doStatementSetBindingStyleDefault(java.sql.Statement ps)
           
 void doStatementSetRowPrefetch(java.sql.Statement ps, int prefetchSize)
          Performs the equivalent of setRowPrefetch() on a statement.
protected static void dumpConstraint(java.lang.Object[] constraintEntry)
          debug method to be called by all implementors of getConstraints - provides formatted output of the complex constraint struct
 void executeBatch(java.sql.PreparedStatement stmt)
           
 java.lang.Object generatePKBasedRef(EntityImpl entityContext)
          Initial (temporay) value for ROWID, so that entity can be added in cache TODO: this is an awkward piece of non-generic JDBC - not sure how to emulate rowids in the generic case
 java.lang.Object[] generateRefAndOID(EntityImpl entityContext)
          Generates an object Ref and OID for an Entity Object.
 java.lang.Object generateRowID(EntityImpl entityContext)
          Generates a ROWID 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
protected  java.lang.String getColumnNameWithFormatForQuery(java.lang.String lhspart, AttributeDef attrDef, int sqltype)
          Deprecated. since 9.0.3
 java.util.Vector getConstraints(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
          return vector of with constraint details for this table where each detail is in a String array with this structure: 0 String owner
 com.sun.java.util.collections.ArrayList getConstraintsList(java.sql.Connection conn, java.lang.String catalog, java.lang.String user_or_schema, java.lang.String full_tablename)
          return vector of with constraint details for this table where each detail is in a String array with this structure: 0 String owner
abstract  java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName, java.lang.String tableName, java.lang.String sequenceName, java.lang.String colName)
           
abstract  java.lang.String getCreateSequenceSQL(java.lang.String sequenceName, int startVal)
           
 java.sql.Timestamp getCurrentDbTime(java.sql.Connection conn)
           
abstract  java.lang.String getDbTimeQuery()
           
abstract  java.lang.String getDbType()
          returns a string uniquely identifying this type of SQLBuilder.
 int getDefaultBindingStyle()
          unless overridden, the binding style is set to JDBC (Oracle versions change this)
abstract  java.lang.String getDropSequenceSQL(java.lang.String sequenceName)
           
abstract  java.lang.String getDropTableSQL(java.lang.String dbObjectName)
           
protected  java.lang.String getFormattedLHSCompareFragment(AttributeDef attrDef, int sqlType, java.lang.String lhs, java.lang.Object rhs)
           
protected  java.lang.String getFormattedLHSCompareFragment(ViewObject vo, ViewCriteria vc, AttributeDef attrDef, int sqlType, java.lang.String lhs, java.lang.Object rhs)
           
protected  java.lang.String getFormattedRHSCompareFragment(AttributeDef attrDef, int sqlType, java.lang.String rhs)
           
protected  java.lang.String getFormattedRHSCompareFragment(ViewObject vo, ViewCriteria vc, AttributeDef attrDef, int sqlType, java.lang.String rhs)
           
protected abstract  java.lang.String getJDBCDriverClassName()
          Concrete implementations of SQLBuilder must elect a default driver name
protected  boolean getLockTrailerIsAtEnd()
           
abstract  java.lang.String getPersistManagerClassName()
          Returns the name of default PersistManager class name.
 java.lang.String getQueryHitCountSQL(RowSet rs)
           
protected  java.lang.String getQuotationMarkLeft()
           
protected  java.lang.String getQuotationMarkRight()
           
protected  java.lang.Object getROWID(EntityImpl entityContext)
          Get the ROWID attribute.
 java.util.Vector getSchemaList(java.sql.Connection conn)
          return a list of schemas for this database (note that for Oracle this is synonymous with users)
 com.sun.java.util.collections.ArrayList getSchemas(java.sql.Connection conn)
          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 ststements to have the rows locked - if the DB is incapable of this then is should return null.
protected  boolean getSupportsAliasInUpdateStatements()
          Assume that aliases are permitted, unless your builder denies it
 java.util.Vector getTableList(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
 com.sun.java.util.collections.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
abstract  java.lang.String getTypeMapName()
          Returns a String identifying the preferred type map to use.
abstract  java.lang.String getVersion()
          Gets a string describing the version of this implentation of this interface.
 ViewCriteriaAdapter getViewCriteriaAdapter()
           
 java.lang.String getViewCriteriaClause(ViewObject vo, ViewCriteria criteria)
           
protected  java.lang.String getWarningText(java.lang.String message)
          for use withinn DebugDiagnostic messages: returns a preamble with the name of the specific implementation in force
 boolean isCharType(int type)
          Tests if a type is character
 boolean isConnectionAlive(java.sql.Connection conn)
           
 boolean isDataSourceJTABased(javax.sql.DataSource ds)
           
abstract  boolean isDisplayBindValueUI()
           
 boolean isNumericType(int type)
          Tests if a type is numeric.
 boolean isStreamType(int sqlTypeId)
          Provides streaming support.
 void jdbcClientSideSecurity(java.util.Properties info, java.util.Hashtable env)
           
 javax.sql.DataSource lookupDataSource(java.lang.String nsUrl, java.lang.String nsUser, java.lang.String nsPasswd, java.lang.String dataSourceName)
           
protected  boolean needsQuotedTableName(java.lang.String tableName)
           
 void populateJboTypeMapEntries()
          Populates the system typemap table with entries appropriate for the JDBC implementation.
 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
protected  boolean shouldSkipDML(EntityImpl entityContext, int operation, TransactionEvent e)
           
 boolean supportsReturningClause()
           
 boolean supportsRowNumQuery()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSQLBuilderImpl

public BaseSQLBuilderImpl()
Method Detail

getVersion

public abstract 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

getDbType

public abstract 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

getTypeMapName

public abstract java.lang.String getTypeMapName()
Description copied from interface: SQLBuilder
Returns a String identifying the preferred type map to use.

Specified by:
getTypeMapName in interface SQLBuilder

getPersistManagerClassName

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

Specified by:
getPersistManagerClassName in interface SQLBuilder

getDbTimeQuery

public abstract java.lang.String getDbTimeQuery()

getDropTableSQL

public abstract java.lang.String getDropTableSQL(java.lang.String dbObjectName)
Specified by:
getDropTableSQL in interface SQLBuilder

getCreateSequenceInsertTriggerSQL

public abstract java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName,
                                                                   java.lang.String tableName,
                                                                   java.lang.String sequenceName,
                                                                   java.lang.String colName)
Specified by:
getCreateSequenceInsertTriggerSQL in interface SQLBuilder

getCreateSequenceSQL

public abstract java.lang.String getCreateSequenceSQL(java.lang.String sequenceName,
                                                      int startVal)
Specified by:
getCreateSequenceSQL in interface SQLBuilder

getDropSequenceSQL

public abstract java.lang.String getDropSequenceSQL(java.lang.String sequenceName)
Specified by:
getDropSequenceSQL in interface SQLBuilder

isDisplayBindValueUI

public abstract boolean isDisplayBindValueUI()
Specified by:
isDisplayBindValueUI in interface SQLBuilder

getDefaultBindingStyle

public int getDefaultBindingStyle()
unless overridden, the binding style is set to JDBC (Oracle versions change this)

Specified by:
getDefaultBindingStyle in interface SQLBuilder

doRegisterDefaultDriver

public void doRegisterDefaultDriver()
                             throws java.sql.SQLException
Description copied from interface: SQLBuilder
Registers the JDBC driver associated with this type of JDBC connection.

Specified by:
doRegisterDefaultDriver in interface SQLBuilder
Throws:
java.sql.SQLException

executeBatch

public void executeBatch(java.sql.PreparedStatement stmt)
                  throws java.sql.SQLException
Specified by:
executeBatch in interface SQLBuilder
Throws:
java.sql.SQLException

shouldSkipDML

protected boolean shouldSkipDML(EntityImpl entityContext,
                                int operation,
                                TransactionEvent e)

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
Parameters:
entityContext - the Entity Object.
operation - one of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - the transaction.

doEntitySelect

public void doEntitySelect(EntityImpl entityContext,
                           boolean lock)
Description copied from interface: SQLBuilder
Perform the appropriate SQL operations to execute a select operation on an Entity Object.

Note: this method is subject to change.

Specified by:
doEntitySelect in interface SQLBuilder
Parameters:
lock - if true, a "SELECT for UPDATE" statement is used.

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
Parameters:
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
Parameters:
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
Parameters:
id - = the id for a savepoint
Throws:
java.sql.SQLException

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
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

doStatementSetBindingStyleDefault

public void doStatementSetBindingStyleDefault(java.sql.Statement ps)
Specified by:
doStatementSetBindingStyleDefault in interface SQLBuilder

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.

Specified by:
doPreparedStatementDefineColumnType in interface SQLBuilder
Throws:
java.sql.SQLException

doPreparedStatementDefines

public void doPreparedStatementDefines(java.sql.PreparedStatement ps,
                                       AttributeDefImpl[] attrs)
Description copied from interface: SQLBuilder
Performs the equivalent of clearDefines() on a prepared statement.

Specified by:
doPreparedStatementDefines in interface SQLBuilder

populateJboTypeMapEntries

public void populateJboTypeMapEntries()
Description copied from interface: SQLBuilder
Populates the system typemap table with entries appropriate for the JDBC implementation.

Specified by:
populateJboTypeMapEntries in interface SQLBuilder

isNumericType

public boolean isNumericType(int type)
Description copied from interface: SQLBuilder
Tests if a type is numeric.

Specified by:
isNumericType in interface SQLBuilder

isCharType

public boolean isCharType(int type)
Description copied from interface: SQLBuilder
Tests if a type is character

Specified by:
isCharType in interface SQLBuilder

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
Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be 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

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
Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be loaded.

generatePKBasedRef

public java.lang.Object generatePKBasedRef(EntityImpl entityContext)
Initial (temporay) value for ROWID, so that entity can be added in cache TODO: this is an awkward piece of non-generic JDBC - not sure how to emulate rowids in the generic case

Specified by:
generatePKBasedRef in interface SQLBuilder

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.

Specified by:
generateRefAndOID in interface SQLBuilder

isStreamType

public boolean isStreamType(int sqlTypeId)
Description copied from interface: SQLBuilder
Provides streaming support.

Specified by:
isStreamType in interface SQLBuilder

generateRowID

public java.lang.Object generateRowID(EntityImpl entityContext)
Description copied from interface: SQLBuilder
Generates a ROWID for an Entity Object.

Specified by:
generateRowID in interface SQLBuilder

getTableList

public java.util.Vector getTableList(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

Specified by:
getTableList in interface SQLBuilder
Throws:
java.lang.Exception

getTables

public com.sun.java.util.collections.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

Specified by:
getTables in interface SQLBuilder
Throws:
java.lang.Exception

checkTableNameForQuotes

public java.lang.String checkTableNameForQuotes(java.lang.String tableName)
Description copied from interface: SQLBuilder
add quotes to any table name that may need it.

Specified by:
checkTableNameForQuotes in interface SQLBuilder

needsQuotedTableName

protected boolean needsQuotedTableName(java.lang.String tableName)

getQuotationMarkLeft

protected java.lang.String getQuotationMarkLeft()

getQuotationMarkRight

protected java.lang.String getQuotationMarkRight()

getLockTrailerIsAtEnd

protected boolean getLockTrailerIsAtEnd()

convertFlags

protected java.lang.String[] convertFlags(boolean bTable,
                                          boolean bAlias,
                                          boolean bView,
                                          boolean bSnap)

getSchemaList

public java.util.Vector getSchemaList(java.sql.Connection conn)
                               throws java.lang.Exception
return a list of schemas for this database (note that for Oracle this is synonymous with users)

Specified by:
getSchemaList in interface SQLBuilder
Throws:
java.lang.Exception

getSchemas

public com.sun.java.util.collections.ArrayList getSchemas(java.sql.Connection conn)
                                                   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)

Specified by:
getSchemas in interface SQLBuilder
Throws:
java.lang.Exception

getWarningText

protected java.lang.String getWarningText(java.lang.String message)
for use withinn DebugDiagnostic messages: returns a preamble with the name of the specific implementation in force


getJDBCDriverClassName

protected abstract java.lang.String getJDBCDriverClassName()
Concrete implementations of SQLBuilder must elect a default driver name


buildUpdateStatement

public java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)
DOCTD: Method declaration TODO: KM _ don't like the fact that this requires an entitydef

Specified by:
buildUpdateStatement in interface SQLBuilder
Parameters:
cols -
retrCols -
retrKeyCols -
Returns:
the DML string

bindInsertStatement

public int bindInsertStatement(EntityImpl entityContext,
                               java.sql.PreparedStatement stmt,
                               AttributeDefImpl[] cols,
                               AttributeDefImpl[] retrCols,
                               AttributeDefImpl[] retrKeyCols,
                               com.sun.java.util.collections.HashMap retrList,
                               boolean batchMode)
                        throws java.sql.SQLException
DOCTD: Method declaration

Specified by:
bindInsertStatement in interface SQLBuilder
Parameters:
stmt -
cols -
retrCols -
retrKeyCols -
retrList -
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,
                               com.sun.java.util.collections.HashMap retrList,
                               boolean batchMode)
                        throws java.sql.SQLException
DOCTD: Method declaration

Specified by:
bindUpdateStatement in interface SQLBuilder
Parameters:
stmt -
cols -
retrCols -
retrKeyCols -
retrList -
Returns:
index of last bind variable set in this statement
Throws:
java.sql.SQLException

bindDeleteStatement

public int bindDeleteStatement(EntityImpl entityContext,
                               java.sql.PreparedStatement stmt)
                        throws java.sql.SQLException
Specified by:
bindDeleteStatement in interface SQLBuilder
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
Throws:
java.sql.SQLException

bindWhereClause

public int bindWhereClause(EntityImpl entityContext,
                           java.sql.PreparedStatement stmt,
                           java.lang.Object rowid,
                           int bindIndex)
                    throws java.sql.SQLException
Bind the Primary key values for the designated Statement. This routine will perform the bind operation for each of the Primary Key columns.

For now it's private. We'll only consider it public when we sort out all of the issues with Sources/Sinks.

The presence or absence of the ROWID value determines whether the ROWID will be used for Row access.

Specified by:
bindWhereClause in interface SQLBuilder
Parameters:
entityContext - the Entity row.
stmt - the statement to bind the columns to.
rowid - the ROWID for the row if known.
bindIndex - the baseline idx for performing the bind operations.
Throws:
java.sql.SQLException

bindWhereClause

public int bindWhereClause(EntityImpl entityContext,
                           java.sql.PreparedStatement stmt,
                           AttributeDefImpl[] keyCols,
                           java.lang.Object rowid,
                           int bindIndex)
                    throws java.sql.SQLException
Specified by:
bindWhereClause in interface SQLBuilder
Throws:
java.sql.SQLException

bindOptUpdateWhereClause

public int bindOptUpdateWhereClause(EntityImpl entityContext,
                                    java.sql.PreparedStatement stmt,
                                    int bindIndex)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getROWID

protected java.lang.Object getROWID(EntityImpl entityContext)
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.

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)
Construct a SQL WHERE clause for the Entity into the designated Buffer, based upon the Source Columns. This routine will construct a SQL WHERE clause in the StringBuffer passed. It does this by appending the various components of the WHERE Clause (based upon Primary Key columns) into the buffer area.

For now it's private. We'll only consider it public when we sort out all of the issues with Sources/Sinks.

The presence or absence of the ROWID value determines whether the ROWID will be used for Row access.

Specified by:
buildWhereClause in interface SQLBuilder
Parameters:
buffer - the area into which the WHERE Clause will be placed.
keyCols - the Primary key columns.
rowid - the ROWID for the ROW if known.

buildOptUpdateWhereClause

public void buildOptUpdateWhereClause(EntityImpl entityContext,
                                      java.lang.StringBuffer buffer,
                                      AttributeDefImpl[] cols)

buildInsertStatement

public java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)
Construct a SQL INSERT statement

Specified by:
buildInsertStatement in interface SQLBuilder

buildDeleteStatement

public java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
Construct a SQL INSERT statement

Specified by:
buildDeleteStatement in interface SQLBuilder

buildSelectString

public void buildSelectString(DBTransactionImpl trans,
                              java.lang.StringBuffer buffer,
                              java.lang.String sourceName,
                              java.lang.String sourceAlias,
                              AttributeDefImpl[] attrs,
                              boolean withIntoClause,
                              int bindingStyle)
Specified by:
buildSelectString in interface SQLBuilder

buildSelectString

protected void buildSelectString(java.lang.StringBuffer buffer,
                                 java.lang.String sourceName,
                                 AttributeDefImpl[] attrs,
                                 boolean withIntoClause)
Construct a SQL SELECT statement for the Entity into the designated Buffer. This routine will construct a SQL SELECT statement in the StringBuffer passed. It does this by appending the various components of the SELECT statement into the buffer area.

Parameters:
buffer - the area into which the SELECT statement will be placed.

getConstraints

public java.util.Vector getConstraints(java.sql.Connection conn,
                                       java.lang.String catalog,
                                       java.lang.String schema,
                                       java.lang.String table)
                                throws java.sql.SQLException
return vector of 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

Specified by:
getConstraints in interface SQLBuilder
Throws:
java.sql.SQLException

getConstraintsList

public com.sun.java.util.collections.ArrayList getConstraintsList(java.sql.Connection conn,
                                                                  java.lang.String catalog,
                                                                  java.lang.String user_or_schema,
                                                                  java.lang.String full_tablename)
                                                           throws java.sql.SQLException
Description copied from interface: SQLBuilder
return vector of 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 <>

Specified by:
getConstraintsList in interface SQLBuilder
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

Specified by:
getBaseTable in interface SQLBuilder
Throws:
java.sql.SQLException

lookupDataSource

public javax.sql.DataSource lookupDataSource(java.lang.String nsUrl,
                                             java.lang.String nsUser,
                                             java.lang.String nsPasswd,
                                             java.lang.String dataSourceName)
                                      throws JboException
Specified by:
lookupDataSource in interface SQLBuilder
Throws:
JboException

isDataSourceJTABased

public boolean isDataSourceJTABased(javax.sql.DataSource ds)
Specified by:
isDataSourceJTABased in interface SQLBuilder

supportsReturningClause

public boolean supportsReturningClause()
Specified by:
supportsReturningClause in interface SQLBuilder

supportsRowNumQuery

public boolean supportsRowNumQuery()
Specified by:
supportsRowNumQuery in interface SQLBuilder

capabilityCanReuseLockStatements

protected boolean capabilityCanReuseLockStatements()

getSqlVariantLockTrailer

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


getSupportsAliasInUpdateStatements

protected boolean getSupportsAliasInUpdateStatements()
Assume that aliases are permitted, unless your builder denies it

Since:
10.1.2 29Jul04

dumpConstraint

protected static void dumpConstraint(java.lang.Object[] constraintEntry)
debug method to be called by all implementors of getConstraints - provides formatted output of the complex constraint struct


getViewCriteriaAdapter

public ViewCriteriaAdapter getViewCriteriaAdapter()
Specified by:
getViewCriteriaAdapter in interface SQLBuilder

convertValueToWhereFragment

protected java.lang.Object convertValueToWhereFragment(AttributeDef curDef,
                                                       java.lang.String trimmedValue)

convertValueToWhereFragment

protected java.lang.Object convertValueToWhereFragment(ViewObject vo,
                                                       ViewCriteria vc,
                                                       AttributeDef curDef,
                                                       java.lang.String trimmedValue)

getViewCriteriaClause

public java.lang.String getViewCriteriaClause(ViewObject vo,
                                              ViewCriteria criteria)
Specified by:
getViewCriteriaClause in interface ViewCriteriaAdapter

getFormattedRHSCompareFragment

protected java.lang.String getFormattedRHSCompareFragment(AttributeDef attrDef,
                                                          int sqlType,
                                                          java.lang.String rhs)

getFormattedRHSCompareFragment

protected java.lang.String getFormattedRHSCompareFragment(ViewObject vo,
                                                          ViewCriteria vc,
                                                          AttributeDef attrDef,
                                                          int sqlType,
                                                          java.lang.String rhs)

getFormattedLHSCompareFragment

protected java.lang.String getFormattedLHSCompareFragment(AttributeDef attrDef,
                                                          int sqlType,
                                                          java.lang.String lhs,
                                                          java.lang.Object rhs)

getFormattedLHSCompareFragment

protected java.lang.String getFormattedLHSCompareFragment(ViewObject vo,
                                                          ViewCriteria vc,
                                                          AttributeDef attrDef,
                                                          int sqlType,
                                                          java.lang.String lhs,
                                                          java.lang.Object rhs)

getColumnNameWithFormatForQuery

protected java.lang.String getColumnNameWithFormatForQuery(java.lang.String lhspart,
                                                           AttributeDef attrDef,
                                                           int sqltype)
Deprecated. since 9.0.3


getCurrentDbTime

public java.sql.Timestamp getCurrentDbTime(java.sql.Connection conn)
Specified by:
getCurrentDbTime in interface SQLBuilder

doRefreshSQL

public void doRefreshSQL(EntityImpl entityContext,
                         int operation,
                         AttributeDefImpl[] columns,
                         AttributeDefImpl[] retrKeyCols)
Specified by:
doRefreshSQL in interface SQLBuilder

getQueryHitCountSQL

public java.lang.String getQueryHitCountSQL(RowSet rs)
Specified by:
getQueryHitCountSQL in interface SQLBuilder

isConnectionAlive

public boolean isConnectionAlive(java.sql.Connection conn)
Specified by:
isConnectionAlive in interface SQLBuilder

convertValueToStorageType

public java.lang.Object convertValueToStorageType(java.lang.Object value)
Abstraction to allow domain types to be not converted if they're jdbc known types.

Specified by:
convertValueToStorageType in interface SQLBuilder

jdbcClientSideSecurity

public void jdbcClientSideSecurity(java.util.Properties info,
                                   java.util.Hashtable env)
Specified by:
jdbcClientSideSecurity in interface SQLBuilder

compareFetchedValue

public boolean compareFetchedValue(EntityImpl entity,
                                   AttributeDefImpl ad,
                                   java.lang.Object cacheValue,
                                   java.lang.Object fetchedValue)
Description copied from interface: SQLBuilder
Compare the cacheValue with fetchedValue and if they are equal return true This api is used when comparing cached entity with a faulted in entity. Signature modified since 9.0.5.1 to allow for Entity context to be available during compare so that Applications could perform custom comparision logic based on either settings in the Entity or any other context available via the entity.

Specified by:
compareFetchedValue in interface SQLBuilder

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

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