|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SQLBuilder
Field Summary | |
---|---|
static int |
BINDING_STYLE_JDBC
Constant used to specify JDBC binding style while binding parameters to a statement object. |
static int |
BINDING_STYLE_ORACLE
Constant used to specify Oracle binding style while binding parameters to a statement object. |
static int |
BINDING_STYLE_ORACLE_NAME
Constant used to specify Oracle Named Parameter binding style while binding parameters to a statement object. |
static int |
BINDING_STYLE_UNKNOWN
Constant used to specify "Unknown" binding style while binding parameters to a statement object. |
static int |
DML_DELETE
Constant used to specify the DML mode to be DELETE. |
static int |
DML_INSERT
Constant used to specify the DML mode to be INSERT. |
static int |
DML_UPDATE
Constant used to specify the DML mode to be UPDATE. |
Method Summary | |
---|---|
int |
bindDeleteStatement(EntityImpl entityContext,
PreparedStatement stmt)
Binds the values in the entity attribute storage with the DELETE statement. |
int |
bindInsertStatement(EntityImpl entityContext,
PreparedStatement stmt,
AttributeDefImpl[] cols,
AttributeDefImpl[] retrCols,
AttributeDefImpl[] retrKeyCols,
java.util.Hashtable retrList,
boolean batchMode)
Binds the entity attribute storage with the parameters in the INSERT statement. |
int |
bindInsertStatement(EntityImpl entityContext,
PreparedStatement stmt,
AttributeDefImpl[] cols,
AttributeDefImpl[] retrCols,
AttributeDefImpl[] retrKeyCols,
Map retrList,
boolean batchMode)
Binds the entity attribute storage with the parameters in the INSERT statement. |
void |
bindParametersForStmt(int bindingStyle,
java.lang.Object[] params,
PreparedStatement stmt)
Bind parameter values for a SQL execution. |
int |
bindUpdateStatement(EntityImpl entityContext,
PreparedStatement stmt,
AttributeDefImpl[] cols,
AttributeDefImpl[] retrCols,
AttributeDefImpl[] retrKeyCols,
java.util.Hashtable retrList,
boolean batchMode)
Binds the entity attribute storage with the parameters in the UPDATE statement. |
int |
bindUpdateStatement(EntityImpl entityContext,
PreparedStatement stmt,
AttributeDefImpl[] cols,
AttributeDefImpl[] retrCols,
AttributeDefImpl[] retrKeyCols,
Map retrList,
boolean batchMode)
Binds the entity attribute storage with the parameters in the UPDATE statement. |
int |
bindWhereClause(EntityImpl entityContext,
PreparedStatement stmt,
AttributeDefImpl[] keyCols,
java.lang.Object rowid,
int bindIndex)
Bind the Primary key values for the designated Statement. |
void |
buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause,
Vector 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) |
void |
buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause,
Vector eRefs)
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.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 |
buildSelectList(java.lang.StringBuffer buffer,
AttributeDefImpl[] attrs,
java.lang.String sourceAlias,
boolean forViewObject)
Build a list of columns that could be used in a SELECT statement. |
void |
buildSelectString(DBTransactionImpl trans,
java.lang.StringBuffer buffer,
java.lang.String sourceName,
java.lang.String sourceAlias,
AttributeDefImpl[] attrs,
boolean withIntoClause,
int bindingStyle)
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)
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)
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)
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 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. |
void |
doEntitySelectForAltKey(EntityImpl e,
int keyIndex,
boolean lock)
|
java.lang.Object[] |
doLoadBulkFromResultSet(AttributeDefImpl[] attrs,
int attrIndex,
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,
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,
PreparedStatement ps,
int index,
Transaction trans)
Loads an object from a result set. |
void |
doPreparedStatementDefineColumnType(PreparedStatement ps,
int colnum,
int sqltype)
Performs the equivalent of defineColumnType() on a prepared statement. |
void |
doPreparedStatementDefines(PreparedStatement ps,
AttributeDefImpl[] attrs)
Defines the column types of the attributes based on the meta-data. |
void |
doRefreshSQL(EntityImpl entityContext,
int operation,
AttributeDefImpl[] columns,
AttributeDefImpl[] keyCols)
Refreshes the entity after an update on the database. |
void |
doStatementSetBindingStyle(Statement ps,
int bindingStyle)
Sets the binding style for the statement. |
void |
doStatementSetBindingStyleDefault(Statement ps)
Sets the binding style to the default value of the database type. |
void |
doStatementSetRowPrefetch(Statement ps,
int prefetchSize)
Performs the equivalent of setRowPrefetch() on a statement. |
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)
Get the ROWID attribute. |
java.lang.String |
getClauseForDateLiteral(java.util.Date date)
Creates a database platform specific clause for converting a date string literal to date datatype. |
java.lang.String |
getDbType()
Returns a string uniquely identifying this type of SQLBuilder. |
java.lang.String |
getQueryHitCountSQL(RowSet rs)
Returns a SQL statement to estimate the number of rows effected by the query using the rowset values. |
ViewCriteriaAdapter |
getViewCriteriaAdapter()
Returns a ViewCriteriaAdapter for the SQLBuilder object. |
void |
processException(java.lang.Class callingClass,
java.lang.String callingMethod,
java.lang.String errorCode,
java.lang.Exception sqlEx,
java.lang.Object[] params)
Handle SQL exceptions by wrapping into SQLStmtException or
JboException . |
java.lang.Object |
registerDatabaseChangeListener(QueryCollection listener,
Connection conn,
Statement stmt)
Register a Query Collection to listen to database data change events. |
void |
releaseSavepoint(Connection conn,
java.lang.String id)
Release SAVEPOINT if possible. |
void |
rollbackToSavepoint(Connection conn,
java.lang.String id)
Rollback to SAVEPOINT if possible. |
void |
setSavepoint(Connection conn,
java.lang.String id)
Issue a SAVEPOINT if possible. |
boolean |
shouldPutJoinConstraintInFromClause()
Checks if the FROM clause allows view criteria. |
boolean |
supportsRowNumQuery()
Checks if the database supports "rownum" identifier. |
void |
unregisterDatabaseChangeListener(java.lang.Object handle)
UnRegister a previous registration to listen to database data change events. |
Field Detail |
---|
static final int DML_INSERT
doEntityDML(EntityImpl, int, TransactionEvent)
,
Constant Field Valuesstatic final int DML_UPDATE
doEntityDML(EntityImpl, int, TransactionEvent)
,
Constant Field Valuesstatic final int DML_DELETE
doEntityDML(EntityImpl, int, TransactionEvent)
,
Constant Field Valuesstatic final int BINDING_STYLE_UNKNOWN
doStatementSetBindingStyle(Statement, int)
,
Constant Field Valuesstatic final int BINDING_STYLE_JDBC
doStatementSetBindingStyle(Statement, int)
,
Constant Field Valuesstatic final int BINDING_STYLE_ORACLE
doStatementSetBindingStyle(Statement, int)
,
Constant Field Valuesstatic final int BINDING_STYLE_ORACLE_NAME
doStatementSetBindingStyle(Statement, int)
,
Constant Field ValuesMethod Detail |
---|
java.lang.String getDbType()
void doEntityDML(EntityImpl enrt, int operation, TransactionEvent e)
Note: this method is subject to change.
enrt
- the Entity Object.operation
- one of DML_INSERT, DML_UPDATE, or DML_DELETE.e
- the transaction.java.lang.StringBuffer buildInsertStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
Note: this method is subject to change.
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.
java.lang.StringBuffer buildUpdateStatement(EntityImpl entityContext, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, boolean batchMode)
Note: this method is subject to change.
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.
java.lang.StringBuffer buildDeleteStatement(EntityImpl entityContext)
Note: this method is subject to change.
entityContext
- the entity object.
void buildWhereClause(EntityImpl entityContext, java.lang.StringBuffer buffer, AttributeDefImpl[] keyCols, java.lang.Object rowid)
Note: this method is subject to change.
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.int bindUpdateStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.Hashtable retrList, boolean batchMode) throws SQLException
Note: this method is subject to change.
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.
SQLException
int bindInsertStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, java.util.Hashtable retrList, boolean batchMode) throws SQLException
Note: this method is subject to change.
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.
SQLException
int bindWhereClause(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] keyCols, java.lang.Object rowid, int bindIndex) throws SQLException
The presence or absence of the ROWID value determines whether the ROWID will be used for Row access.
Note: this method is subject to change.
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.
SQLException
int bindDeleteStatement(EntityImpl entityContext, PreparedStatement stmt) throws SQLException
Note: this method is subject to change.
entityContext
- the entity object.stmt
- the statement handle executing the DELETE statement.
SQLException
void bindParametersForStmt(int bindingStyle, java.lang.Object[] params, PreparedStatement stmt) throws SQLException
Note: this method is subject to change.
bindingStyle
- specifies if Oracle, Oracle named parameter or JDBC binding style is used.params
- the list of parameters.stmt
- the statement to be executed.
SQLException
void buildSelectList(java.lang.StringBuffer buffer, AttributeDefImpl[] attrs, java.lang.String sourceAlias, boolean forViewObject)
Note: this method is subject to change.
buffer
- the StringBuffer object to which the SELECT list is appended.attrs
- the list of attribute definitions to be considered for the SELECT list.sourceAlias
- the database object name that contains the attributes.void buildDefaultViewObjectFromClause(java.lang.StringBuffer fromClause, Vector eRefs, BaseViewCriteriaManagerImpl vcManager)
ViewDefImpl.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
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 builtboolean shouldPutJoinConstraintInFromClause()
ViewCriteriaAdapter getViewCriteriaAdapter()
Note: this method is subject to change.
void buildDefaultViewObjectWhereClause(java.lang.StringBuffer whereClause, Vector eRefs)
ViewDefImpl.setWhereClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT)
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.java.lang.String getClauseForDateLiteral(java.util.Date date)
date
- The date object that will be formatted and passed as a String
boolean supportsRowNumQuery()
Note: this method is subject to change.
void doStatementSetRowPrefetch(Statement ps, int prefetchSize) throws SQLException
ps
- the Statement object.prefetchSize
- the fetch size.
SQLException
void doStatementSetBindingStyle(Statement ps, int bindingStyle)
ps
- the Statement object.bindingStyle
- valid values are BINDING_STYLE_JDBC, BINDING_STYLE_ORACLE, BINDING_STYLE_ORACLE_NAME.java.lang.Object convertValueToStorageType(java.lang.Object value)
Note: this method is subject to change.
value
- the object that needs to be converted.
java.lang.Object doLoadFromResultSet(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, byte attrLoad, ResultSet rs, int index, DBTransactionImpl trans)
Note: this method is subject to change.
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.
DataCreationException
void doEntitySelect(EntityImpl e, boolean lock)
Note: this method is subject to change. Note: this method is subject to change.
e
- the Entity Object.lock
- if true, a "SELECT for UPDATE" statement is used.void doEntitySelectForAltKey(EntityImpl e, int keyIndex, boolean lock)
java.lang.Object generateRowID(EntityImpl e)
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.
Note: this method is subject to change.
e
- the entity object reference.
java.lang.Object[] generateRefAndOID(EntityImpl e)
Note: this method is subject to change.
e
- the entity object reference.boolean compareFetchedValue(EntityImpl entity, AttributeDefImpl ad, java.lang.Object cacheValue, java.lang.Object fetchedValue)
Note: this method is subject to change.
entity
- the entity object.ad
- the attribute definition of the value being compared.cacheValue
- the cached value.fetchedValue
- the new fetched value.
java.lang.Object[] doLoadBulkFromResultSet(AttributeDefImpl[] attrs, int attrIndex, ResultSet rs, int rsIndex, DBTransactionImpl trans) throws DataCreationException
Note: this method is subject to change.
attrs
- the list of attributes to be loaded.attrIndex
- a particular attribute from the list - Currently unused.rs
- the ResultSet containing the objects.rsIndex
- the index of the object in the result set to be loaded.trans
- the reference to the transaction object used to fetch the resultset.
DataCreationException
java.lang.Object registerDatabaseChangeListener(QueryCollection listener, Connection conn, Statement stmt)
listener
- The Query Collection that holds the qualifying rowsconn
- Connection objectstmt
- The SQL Statement that needs to be monitored for the
database to trigger notifications.
void doPreparedStatementDefines(PreparedStatement ps, AttributeDefImpl[] attrs)
Note: this method is subject to change.
ps
- the PreparedStatement object.attrs
- the attribute definitions.void processException(java.lang.Class callingClass, java.lang.String callingMethod, java.lang.String errorCode, java.lang.Exception sqlEx, java.lang.Object[] params)
SQLStmtException
or
JboException
.
Note: this method is subject to change.
errorCode
- the SQL execution errorcode.sqlEx
- the Exception object.params
- the query parameters.void unregisterDatabaseChangeListener(java.lang.Object handle)
Object
- handle to the previous registration.java.lang.Object generatePKBasedRef(EntityImpl entityContext)
Note: this method is subject to change.
entityContext
- the entity object reference.void rollbackToSavepoint(Connection conn, java.lang.String id) throws SQLException
conn
- the Connection used to rollback the savepoint.id
- the id for a savepoint
SQLException
void setSavepoint(Connection conn, java.lang.String id) throws SQLException
conn
- the Connection used to create a savepoint.id
- the id for a savepoint.
SQLException
void releaseSavepoint(Connection conn, java.lang.String id) throws SQLException
conn
- the Connection used to release the savepoint.id
- the id for a savepoint
SQLException
void doRefreshSQL(EntityImpl entityContext, int operation, AttributeDefImpl[] columns, AttributeDefImpl[] keyCols)
Note: this method is subject to change.
entityContext
- the Entity row.operation
- SQL Operationcolumns
- Columns to be selected.keyCols
- Key columns to appear be to used to refresh, which appear in WHERE clause.void buildSelectString(DBTransactionImpl trans, java.lang.StringBuffer buffer, java.lang.String sourceName, java.lang.String sourceAlias, AttributeDefImpl[] attrs, boolean withIntoClause, int bindingStyle)
Note: this method is subject to change.
trans
- a reference to the transaction object.buffer
- the StringBuffer object to which the SELECT statement is appended.sourceName
- the database object from which the Columns are selected.sourceAlias
- the database object alias.attrs
- the attributes that are selected from the database object.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.int bindInsertStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, Map retrList, boolean batchMode) throws SQLException
Note: this method is subject to change.
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.
SQLException
int bindUpdateStatement(EntityImpl entityContext, PreparedStatement stmt, AttributeDefImpl[] cols, AttributeDefImpl[] retrCols, AttributeDefImpl[] retrKeyCols, Map retrList, boolean batchMode) throws SQLException
Note: this method is subject to change.
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.
SQLException
java.lang.Object doLoadFromStatement(java.lang.Object theTypeFactory, java.lang.Object theElemFactory, java.lang.Class theJavaType, PreparedStatement ps, int index, Transaction trans) throws DataCreationException
Note: this method is subject to change.
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.
DataCreationException
void doStatementSetBindingStyleDefault(Statement ps)
Note: this method is subject to change.
ps
- the Statement object.java.lang.String getQueryHitCountSQL(RowSet rs)
Note: this method is subject to change.
rs
- the RowSet object.
void doPreparedStatementDefineColumnType(PreparedStatement ps, int colnum, int sqltype) throws SQLException
Note: this method is subject to change.
ps
- the PreparedStatement object.colnum
- the column number.sqltype
- the type of the column.
SQLException
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |