public abstract class DatabaseCall extends DatasourceCall
Modifier and Type | Field and Description |
---|---|
protected Vector |
fields |
protected int |
firstResult |
protected boolean |
hasOptimisticLock |
protected boolean |
isCallableStatementRequired |
protected boolean |
isCursorOutputProcedure |
protected boolean |
isFieldMatchingRequired |
protected boolean |
isResultSetScrollable |
protected int |
maxRows |
protected int |
queryTimeout |
protected ResultSet |
result |
protected int |
resultSetConcurrency |
protected int |
resultSetType |
protected int |
returnsResultSet |
protected boolean |
shouldBuildOutputRow |
protected int |
shouldCacheStatement |
protected String |
sqlString |
protected Statement |
statement |
protected int |
usesBinding |
CUSTOM_MODIFY, IN, INOUT, isPrepared, LITERAL, MODIFY, NO_RETURN, OUT, OUT_CURSOR, parameters, parameterTypes, query, RETURN_CURSOR, RETURN_MANY_ROWS, RETURN_ONE_ROW, returnType, TRANSLATION
Constructor and Description |
---|
DatabaseCall() |
Modifier and Type | Method and Description |
---|---|
void |
addContext(DatabaseField field,
Object value)
INTERNAL:
Add a field - value pair for LOB field into the context.
|
void |
appendIn(Object inObject)
INTERNAL:
|
void |
appendInOut(DatabaseField inoutField)
INTERNAL:
|
void |
appendInOut(Object inValueOrField,
DatabaseField outField)
INTERNAL:
|
static void |
appendLogParameters(Collection parameters,
Accessor accessor,
StringWriter writer,
AbstractSession session)
Print the parameters to the write for logging purposes.
|
void |
appendOut(DatabaseField outField)
INTERNAL:
|
void |
appendOutCursor(DatabaseField outField)
INTERNAL:
|
void |
appendParameter(Writer writer,
Object parameter,
AbstractSession session)
Add the parameter.
|
void |
bindParameter(Writer writer,
Object parameter)
Bind the parameter.
|
DatabaseQueryMechanism |
buildNewQueryMechanism(DatabaseQuery query)
Return the appropriate mechanism,
with the call added as necessary.
|
AbstractRecord |
buildOutputRow(CallableStatement statement)
INTERNAL:
Return DatabaseRow containing output fields and values.
|
DatabaseQueryMechanism |
buildQueryMechanism(DatabaseQuery query,
DatabaseQueryMechanism mechanism)
Return the appropriate mechanism,
with the call added as necessary.
|
protected Object |
createInOutParameter(Object inValue,
Object outParameter,
AbstractSession session)
INTERNAL:
Returns INOUT parameter.
|
String |
getCallString()
INTERNAL:
Return the SQL string for the call.
|
AbstractRecord |
getContexts()
INTERNAL:
Return the contexts (for LOB)
|
int |
getCursorOutIndex()
INTERNAL:
Return 1-based index of out cursor parameter, or -1.
|
Vector |
getFields()
The fields expected by the calls result set.
|
protected DatabaseField |
getFieldWithTypeFromDescriptor(DatabaseField outField)
INTERNAL:
Unfortunately can't avoid referencing query and descriptor:
the call should be performed after the translateCustomSQL (in SQLCall)
in the middle of prepare method (no parameter available earlier).
|
int |
getFirstResult()
get first result
|
String |
getLogString(Accessor accessor)
Return the SQL string for logging purposes.
|
int |
getMaxRows()
get max rows returned from the call
|
Vector |
getOutputRowFields()
INTERNAL
Returns the fields to be used in output row.
|
String |
getQueryString()
INTERNAL:
Return the query string (SQL) of the call.
|
ResultSet |
getResult()
The result set is stored for the return value of cursor selects.
|
int |
getResultSetConcurrency() |
int |
getResultSetType() |
boolean |
getReturnsResultSet()
ADVANCED:
This method returns a value that represents if the customer has set whether or not TopLink should expect
the stored procedure to returning a JDBC ResultSet.
|
String |
getSQLString()
Return the SQL string that will be executed.
|
Statement |
getStatement()
The statement is stored for the return value of cursor selects.
|
boolean |
hasOptimisticLock()
This check is needed only when doing batch writing.
|
protected boolean |
isCallableStatementRequired()
Callable statement is required if there is an output parameter.
|
boolean |
isCursorOutputProcedure()
Used for Oracle result sets through procedures.
|
boolean |
isCursorReturned()
The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
|
protected boolean |
isDynamicCall(AbstractSession session)
Return if the call is dynamic SQL call.
|
boolean |
isFieldMatchingRequired()
Return if field matching is required.
|
boolean |
isFinished()
Return whether all the results of the call have been returned.
|
boolean |
isLOBLocatorNeeded()
INTERNAL:
Return if the locator is required for the LOB (BLOB and CLOB) writing.
|
boolean |
isNonCursorOutputProcedure()
Return true for procedures with any output (or in/out) parameters and no cursors
|
boolean |
isResultSetScrollable() |
void |
matchFieldOrder(ResultSet resultSet,
DatabaseAccessor accessor,
AbstractSession session)
Allow for the field order to be matched if required.
|
void |
prepare(AbstractSession session)
INTERNAL:
Allow pre-printing of the SQL string for fully bound calls, to save from reprinting.
|
protected void |
prepareInternal(AbstractSession session)
INTERNAL:
Called by prepare method only.
|
Statement |
prepareStatement(DatabaseAccessor accessor,
AbstractRecord translationRow,
AbstractSession session)
INTERNAL:
Prepare the JDBC statement, this may be parameterize or a call statement.
|
void |
setContexts(AbstractRecord contexts)
INTERNAL:
Set the contexts (for LOB)
|
void |
setFields(Vector fields)
The fields expected by the calls result set.
|
void |
setFirstResult(int firstResult)
The firstResult set on the result set
|
void |
setHasOptimisticLock(boolean hasOptimisticLock)
This check is needed only when doing batch writing and we hit on optimistic locking.
|
protected void |
setIsCallableStatementRequired(boolean isCallableStatementRequired)
Callable statement is required if there is an output parameter.
|
void |
setIsCursorOutputProcedure(boolean isCursorOutputProcedure)
Used for Oracle result sets through procedures.
|
void |
setIsFieldMatchingRequired(boolean isFieldMatchingRequired)
Field matching is required for custom SQL statements where the result set field order is not known.
|
void |
setIsResultSetScrollable(boolean isResultSetScrollable) |
void |
setMaxRows(int maxRows)
set query max returned row size to the JDBC Statement
|
void |
setQueryString(String queryString)
INTERNAL:
Set the query string (SQL) of the call.
|
void |
setResult(ResultSet result)
The result set is stored for the return value of cursor selects.
|
void |
setResultSetConcurrency(int resultSetConcurrency) |
void |
setResultSetType(int resultSetType) |
void |
setReturnsResultSet(boolean returnsResultSet)
PUBLIC:
Use this method to tell TopLink that the stored procedure will be returning a JDBC ResultSet
|
protected void |
setShouldBuildOutputRow(boolean shouldBuildOutputRow)
INTERNAL:
Set whether the call has to build output row
|
void |
setShouldCacheStatement(boolean shouldCacheStatement)
Bound calls can use prepared statement caching.
|
protected void |
setSQLStringInternal(String sqlString)
INTERNAL:
Set the SQL string.
|
void |
setStatement(Statement statement)
The statement is stored for the return value of cursor selects.
|
void |
setUsesBinding(boolean usesBinding)
The call may specify that its parameters should be bound.
|
boolean |
shouldBuildOutputRow()
Set whether the call has to build output row
|
boolean |
shouldCacheStatement(AbstractSession session)
Bound calls can use prepared statement caching.
|
boolean |
shouldCacheStatement(DatabasePlatform databasePlatform)
Bound calls can use prepared statement caching.
|
String |
toString()
INTERNAL:
Print the SQL string.
|
void |
translate(AbstractRecord translationRow,
AbstractRecord modifyRow,
AbstractSession session)
INTERNAL:
Allow the call to translate from the translation for predefined calls.
|
boolean |
usesBinding(AbstractSession session)
The call may specify that its parameters should be bound.
|
boolean |
usesBinding(DatabasePlatform databasePlatform)
The call may specify that its parameters should be bound.
|
void |
useUnnamedCursorOutputAsResultSet()
PUBLIC:
Used for Oracle result sets through procedures.
|
appendIn, appendInOut, appendLiteral, appendModify, appendOut, appendTranslation, areManyRowsReturned, argumentMarker, clone, createField, getParameters, getParameterTypes, getQuery, getReturnType, getValueForInOutParameter, getValueForInParameter, hasParameters, isEISInteraction, isEJBQLCall, isNothingReturned, isOneRowReturned, isOutputParameterType, isPrepared, isQueryStringCall, isSQLCall, isStoredFunctionCall, isStoredProcedureCall, returnCursor, returnManyRows, returnNothing, returnOneRow, setIsPrepared, setParameters, setParameterTypes, setQuery, setReturnType, translateCustomQuery, translatePureSQLCustomQuery, translateQueryString, whitespace
protected transient Statement statement
protected transient ResultSet result
protected int usesBinding
protected int shouldCacheStatement
protected transient Vector fields
protected boolean isFieldMatchingRequired
protected boolean hasOptimisticLock
protected boolean isResultSetScrollable
protected int resultSetType
protected int resultSetConcurrency
protected int queryTimeout
protected int maxRows
protected int firstResult
protected boolean isCursorOutputProcedure
protected int returnsResultSet
protected boolean shouldBuildOutputRow
protected boolean isCallableStatementRequired
protected String sqlString
public void appendIn(Object inObject)
public void appendInOut(DatabaseField inoutField)
public void appendInOut(Object inValueOrField, DatabaseField outField)
public void appendOut(DatabaseField outField)
public void appendOutCursor(DatabaseField outField)
public void appendParameter(Writer writer, Object parameter, AbstractSession session)
appendParameter
in class DatasourceCall
public void bindParameter(Writer writer, Object parameter)
public DatabaseQueryMechanism buildNewQueryMechanism(DatabaseQuery query)
buildNewQueryMechanism
in interface Call
buildNewQueryMechanism
in class DatasourceCall
public AbstractRecord buildOutputRow(CallableStatement statement) throws SQLException
SQLException
public DatabaseQueryMechanism buildQueryMechanism(DatabaseQuery query, DatabaseQueryMechanism mechanism)
buildQueryMechanism
in interface Call
buildQueryMechanism
in class DatasourceCall
protected Object createInOutParameter(Object inValue, Object outParameter, AbstractSession session)
createInOutParameter
in class DatasourceCall
public String getCallString()
public Vector getFields()
protected DatabaseField getFieldWithTypeFromDescriptor(DatabaseField outField)
public int getCursorOutIndex()
public int getFirstResult()
public String getLogString(Accessor accessor)
getLogString
in interface Call
getLogString
in class DatasourceCall
public static void appendLogParameters(Collection parameters, Accessor accessor, StringWriter writer, AbstractSession session)
public int getMaxRows()
public Vector getOutputRowFields()
public String getQueryString()
getQueryString
in class DatasourceCall
public ResultSet getResult()
public boolean getReturnsResultSet()
public int getResultSetConcurrency()
public int getResultSetType()
public String getSQLString()
public Statement getStatement()
public boolean hasOptimisticLock()
protected boolean isCallableStatementRequired()
protected boolean isDynamicCall(AbstractSession session)
public boolean isCursorOutputProcedure()
public boolean isCursorReturned()
isCursorReturned
in class DatasourceCall
public boolean isFieldMatchingRequired()
public boolean isFinished()
isFinished
in interface Call
isFinished
in class DatasourceCall
public boolean isNonCursorOutputProcedure()
public boolean isResultSetScrollable()
public void matchFieldOrder(ResultSet resultSet, DatabaseAccessor accessor, AbstractSession session)
public void prepare(AbstractSession session)
prepare
in class DatasourceCall
protected void prepareInternal(AbstractSession session)
public Statement prepareStatement(DatabaseAccessor accessor, AbstractRecord translationRow, AbstractSession session) throws SQLException
SQLException
public void setFields(Vector fields)
public void setFirstResult(int firstResult)
public void setHasOptimisticLock(boolean hasOptimisticLock)
protected void setIsCallableStatementRequired(boolean isCallableStatementRequired)
public void setIsCursorOutputProcedure(boolean isCursorOutputProcedure)
public void setIsFieldMatchingRequired(boolean isFieldMatchingRequired)
public void setIsResultSetScrollable(boolean isResultSetScrollable)
public void setMaxRows(int maxRows)
public void setQueryString(String queryString)
setQueryString
in class DatasourceCall
public void setResult(ResultSet result)
public void setResultSetConcurrency(int resultSetConcurrency)
protected void setSQLStringInternal(String sqlString)
public void setResultSetType(int resultSetType)
public void setReturnsResultSet(boolean returnsResultSet)
protected void setShouldBuildOutputRow(boolean shouldBuildOutputRow)
public void setShouldCacheStatement(boolean shouldCacheStatement)
public void setStatement(Statement statement)
public void setUsesBinding(boolean usesBinding)
public boolean shouldBuildOutputRow()
public boolean shouldCacheStatement(AbstractSession session)
public boolean shouldCacheStatement(DatabasePlatform databasePlatform)
public String toString()
public void translate(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session)
translate
in class DatasourceCall
public boolean usesBinding(AbstractSession session)
public boolean usesBinding(DatabasePlatform databasePlatform)
public boolean isLOBLocatorNeeded()
public void addContext(DatabaseField field, Object value)
public AbstractRecord getContexts()
public void setContexts(AbstractRecord contexts)
public void useUnnamedCursorOutputAsResultSet()
Copyright © 2024. All rights reserved.