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

oracle.jbo.server
Interface SQLBuilder

All Known Implementing Classes:
BaseSQLBuilderImpl

public interface SQLBuilder

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
static int BINDING_STYLE_JDBC
           
static int BINDING_STYLE_ORACLE
           
static int BINDING_STYLE_UNKNOWN
           
static int DML_DELETE
           
static int DML_INSERT
           
static int DML_UPDATE
           
 
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)
           
 int bindUpdateStatement(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, com.sun.java.util.collections.HashMap retrList, boolean batchMode)
           
 int bindWhereClause(EntityImpl entityContext, java.sql.PreparedStatement stmt, AttributeDefImpl[] retrKeyCols, java.lang.Object rowid, int bindIndex)
           
 int bindWhereClause(EntityImpl entityContext, java.sql.PreparedStatement stmt, java.lang.Object rowid, int bindIndex)
           
 java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
           
 java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
           
 void buildSelectString(DBTransactionImpl trans, java.lang.StringBuffer buffer, java.lang.String sourceName, java.lang.String sourceAlias, AttributeDefImpl[] attrs, boolean withIntoClause, int bindingStyle)
           
 java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
           
 void buildWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] keyCols, java.lang.Object rowid)
           
 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.
 java.lang.Object convertValueToStorageType(java.lang.Object value)
           
 void doEntityDML(EntityImpl enrt, 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 e, boolean lock)
          Perform the appropriate SQL operations to execute a select operation on an Entity Object.
 java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs, int attrIndex, java.sql.ResultSet rs, int rsIndex, 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[] keyCols)
           
 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.
 void executeBatch(java.sql.PreparedStatement stmt)
           
 java.lang.Object generatePKBasedRef(EntityImpl entityContext)
          Generates a PK-Based REF for an Entity Object.
 java.lang.Object[] generateRefAndOID(EntityImpl e)
          Generates an object Ref and OID for an Entity Object.
 java.lang.Object generateRowID(EntityImpl e)
          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
 java.util.Vector getConstraints(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema, java.lang.String table)
           
 com.sun.java.util.collections.ArrayList getConstraintsList(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
 java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName, java.lang.String tableName, java.lang.String sequenceName, java.lang.String colName)
           
 java.lang.String getCreateSequenceSQL(java.lang.String sequenceName, int startVal)
           
 java.sql.Timestamp getCurrentDbTime(java.sql.Connection conn)
           
 java.lang.String getDbType()
          returns a string uniquely identifying this type of SQLBuilder.
 int getDefaultBindingStyle()
          returns a constant identifying the best binding style for this sort of SQL (see the BINDINGSTYLE constants)
 java.lang.String getDropSequenceSQL(java.lang.String sequenceName)
           
 java.lang.String getDropTableSQL(java.lang.String dbObjectName)
           
 java.lang.String getPersistManagerClassName()
          Returns the name of default PersistManager class name.
 java.lang.String getQueryHitCountSQL(RowSet rs)
           
 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)
 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
 java.lang.String getTypeMapName()
          Returns a String identifying the preferred type map to use.
 java.lang.String getVersion()
          Gets a string describing the version of this implentation of this interface.
 ViewCriteriaAdapter getViewCriteriaAdapter()
           
 boolean isCharType(int type)
          Tests if a type is character
 boolean isConnectionAlive(java.sql.Connection conn)
           
 boolean isDataSourceJTABased(javax.sql.DataSource ds)
           
 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)
           
 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
 boolean supportsReturningClause()
           
 boolean supportsRowNumQuery()
           
 

Field Detail

DML_INSERT

public static final int DML_INSERT
See Also:
Constant Field Values

DML_UPDATE

public static final int DML_UPDATE
See Also:
Constant Field Values

DML_DELETE

public static final int DML_DELETE
See Also:
Constant Field Values

BINDING_STYLE_UNKNOWN

public static final int BINDING_STYLE_UNKNOWN
See Also:
Constant Field Values

BINDING_STYLE_JDBC

public static final int BINDING_STYLE_JDBC
See Also:
Constant Field Values

BINDING_STYLE_ORACLE

public static final int BINDING_STYLE_ORACLE
See Also:
Constant Field Values
Method Detail

getVersion

public java.lang.String getVersion()
Gets a string describing the version of this implentation of this interface.


getDbType

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


getTypeMapName

public java.lang.String getTypeMapName()
Returns a String identifying the preferred type map to use.


getPersistManagerClassName

public java.lang.String getPersistManagerClassName()
Returns the name of default PersistManager class name.


getDefaultBindingStyle

public int getDefaultBindingStyle()
returns a constant identifying the best binding style for this sort of SQL (see the BINDINGSTYLE constants)


doRegisterDefaultDriver

public void doRegisterDefaultDriver()
                             throws java.sql.SQLException
Registers the JDBC driver associated with this type of JDBC connection.

Throws:
java.sql.SQLException

doEntityDML

public void doEntityDML(EntityImpl enrt,
                        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.

Note: this method is subject to change.

Parameters:
enrt - the Entity Object.
operation - one of DML_INSERT, DML_UPDATE, or DML_DELETE.
e - the transaction.

buildInsertStatement

public java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)

buildUpdateStatement

public java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext,
                                                   AttributeDefImpl[] cols,
                                                   AttributeDefImpl[] retrCols,
                                                   AttributeDefImpl[] retrKeyCols,
                                                   boolean batchMode)

buildDeleteStatement

public java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)

buildSelectString

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

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
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
Throws:
java.sql.SQLException

bindDeleteStatement

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

bindWhereClause

public int bindWhereClause(EntityImpl entityContext,
                           java.sql.PreparedStatement stmt,
                           AttributeDefImpl[] retrKeyCols,
                           java.lang.Object rowid,
                           int bindIndex)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

doEntitySelect

public void doEntitySelect(EntityImpl e,
                           boolean lock)
Perform the appropriate SQL operations to execute a select operation on an Entity Object.

Note: this method is subject to change.

Parameters:
lock - if true, a "SELECT for UPDATE" statement is used.

doStatementSetRowPrefetch

public void doStatementSetRowPrefetch(java.sql.Statement ps,
                                      int prefetchSize)
                               throws java.sql.SQLException
Performs the equivalent of setRowPrefetch() on a statement.

Throws:
java.sql.SQLException

doStatementSetBindingStyle

public void doStatementSetBindingStyle(java.sql.Statement ps,
                                       int bindingStyle)
Sets the binding style for the statement.


doStatementSetBindingStyleDefault

public void doStatementSetBindingStyleDefault(java.sql.Statement ps)

doPreparedStatementDefineColumnType

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

Throws:
java.sql.SQLException

doPreparedStatementDefines

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


populateJboTypeMapEntries

public void populateJboTypeMapEntries()
Populates the system typemap table with entries appropriate for the JDBC implementation.


isNumericType

public boolean isNumericType(int type)
Tests if a type is numeric.


isCharType

public boolean isCharType(int type)
Tests if a type is character


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)
                                     throws DataCreationException
Loads an object from a result set.

Note: this method is subject to change.

Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be loaded.
Throws:
DataCreationException

doLoadBulkFromResultSet

public java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs,
                                                  int attrIndex,
                                                  java.sql.ResultSet rs,
                                                  int rsIndex,
                                                  DBTransactionImpl trans)
                                           throws DataCreationException
Loads an array of objects from a result set.

Note: this method is subject to change.

Throws:
DataCreationException

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)
                                     throws DataCreationException
Loads an object from a result set.

Note: this method is subject to change.

Parameters:
theTypeFactory - a custom factory to be used for constructing new instances.
index - the index of the object to be loaded.
Throws:
DataCreationException

setSavepoint

public void setSavepoint(java.sql.Connection conn,
                         java.lang.String id)
                  throws java.sql.SQLException
issue a SAVEPOINT - if possible

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
rollback to SAVEPOINT - if possible

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
release SAVEPOINT - if possible

Parameters:
id - = the id for a savepoint
Throws:
java.sql.SQLException

generateRowID

public java.lang.Object generateRowID(EntityImpl e)
Generates a ROWID for an Entity Object.


generatePKBasedRef

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


generateRefAndOID

public java.lang.Object[] generateRefAndOID(EntityImpl e)
Generates an object Ref and OID for an Entity Object. This is used for an object table.


isStreamType

public boolean isStreamType(int sqlTypeId)
Provides streaming support.


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
return a list of tables visible in this connection

Throws:
java.lang.Exception

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
return a list of tables visible in this connection

Throws:
java.lang.Exception

getSchemas

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

Throws:
java.lang.Exception

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)

Throws:
java.lang.Exception

getConstraintsList

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

12 String fkname

13 String fkother <>

Throws:
java.sql.SQLException

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
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
unroll any synonyms that may be present, and get the real objectname

Throws:
java.sql.SQLException

checkTableNameForQuotes

public java.lang.String checkTableNameForQuotes(java.lang.String tableName)
add quotes to any table name that may need it.


executeBatch

public void executeBatch(java.sql.PreparedStatement stmt)
                  throws java.sql.SQLException
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
Throws:
JboException

isDataSourceJTABased

public boolean isDataSourceJTABased(javax.sql.DataSource ds)

getViewCriteriaAdapter

public ViewCriteriaAdapter getViewCriteriaAdapter()

getCurrentDbTime

public java.sql.Timestamp getCurrentDbTime(java.sql.Connection conn)

getCreateSequenceInsertTriggerSQL

public java.lang.String getCreateSequenceInsertTriggerSQL(java.lang.String triggerName,
                                                          java.lang.String tableName,
                                                          java.lang.String sequenceName,
                                                          java.lang.String colName)

getCreateSequenceSQL

public java.lang.String getCreateSequenceSQL(java.lang.String sequenceName,
                                             int startVal)

getDropSequenceSQL

public java.lang.String getDropSequenceSQL(java.lang.String sequenceName)

getDropTableSQL

public java.lang.String getDropTableSQL(java.lang.String dbObjectName)

isDisplayBindValueUI

public boolean isDisplayBindValueUI()

doRefreshSQL

public void doRefreshSQL(EntityImpl entityContext,
                         int operation,
                         AttributeDefImpl[] columns,
                         AttributeDefImpl[] keyCols)

supportsReturningClause

public boolean supportsReturningClause()

getQueryHitCountSQL

public java.lang.String getQueryHitCountSQL(RowSet rs)

supportsRowNumQuery

public boolean supportsRowNumQuery()

isConnectionAlive

public boolean isConnectionAlive(java.sql.Connection conn)

buildWhereClause

public void buildWhereClause(EntityImpl entityContext,
                             java.lang.StringBuffer buffer,
                             AttributeDefImpl[] keyCols,
                             java.lang.Object rowid)

convertValueToStorageType

public java.lang.Object convertValueToStorageType(java.lang.Object value)

jdbcClientSideSecurity

public void jdbcClientSideSecurity(java.util.Properties info,
                                   java.util.Hashtable env)

compareFetchedValue

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


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

 

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