Module org.eclipse.persistence.core
Class DatasourceCall
java.lang.Object
org.eclipse.persistence.internal.databaseaccess.DatasourceCall
- All Implemented Interfaces:
Serializable,Cloneable,Call
- Direct Known Subclasses:
DatabaseCall,EISInteraction
INTERNAL:
Purpose: Used as an abstraction of a datasource invocation.
- Since:
- OracleAS TopLink 10g (10.0.3)
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected booleanAllow connection unwrapping to be configured.protected booleanprotected static final intprotected List<DatabaseField> Keep a list of the output cursors.protected List<DatasourceCall.ParameterType> protected DatabaseQueryprotected static final intprotected static final intprotected static final intprotected intprotected booleanprotected BooleanThe call may specify that all of its parameters should/shouldn't be bound. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendIn(Writer writer, DatabaseField field) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidINTERNAL:voidINTERNAL:voidappendInOut(Writer writer, DatabaseField inoutField) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidappendInOut(Object inValueOrField, DatabaseField outField) INTERNAL:voidappendInOut(Object inValueOrField, DatabaseField outField, Boolean shouldBind) INTERNAL:voidappendInOut(DatabaseField inoutField) INTERNAL:voidappendInOut(DatabaseField inoutField, Boolean shouldBind) INTERNAL:voidappendLiteral(Writer writer, Object literal) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidappendLiteral(Object literal) INTERNAL:voidappendLiteral(Object literal, Boolean shouldBind) INTERNAL:voidappendModify(Writer writer, DatabaseField modifyField) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidappendModify(DatabaseField modifyField) INTERNAL:voidappendModify(DatabaseField modifyField, Boolean shouldBind) INTERNAL:voidappendOut(Writer writer, DatabaseField outField) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidappendOut(DatabaseField outField) INTERNAL:voidappendOut(DatabaseField outField, Boolean shouldBind) INTERNAL:voidappendOutCursor(DatabaseField outField) INTERNAL:voidappendOutCursor(DatabaseField outField, Boolean shouldBind) INTERNAL:voidappendParameter(Writer writer, Object parameter, boolean shouldBind, AbstractSession session) Add the parameter using the DatasourcePlatform.voidappendTranslation(Writer writer, DatabaseField modifyField) INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.voidappendTranslation(DatabaseField modifyField) INTERNAL:voidappendTranslation(DatabaseField modifyField, Boolean shouldBind) INTERNAL:booleanThe return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.protected charINTERNAL: Return the character to use for the argument marker.Return the appropriate mechanism, with the call added as necessary.buildQueryMechanism(DatabaseQuery query, DatabaseQueryMechanism mechanism) Return the appropriate mechanism, with the call added as necessary.clone()INTERNAL: Return a clone of the call.protected DatabaseFieldcreateField(String fieldName) INTERNAL: Create a new Database Field This method can be overridden by subclasses to return other field typesprotected ObjectcreateInOutParameter(Object inValue, Object outParameter, AbstractSession session) INTERNAL: Returns INOUT parameter.abstract StringgetLogString(Accessor accessor) Return the SQL string for logging purposes.INTERNAL: Return the output cursors for this stored procedure call.The parameter binding determines if the specific parameter should be bound.The parameters are the values in order of occurrence in the SQL statement.The parameter types determine if the parameter is a modify, translation or literal type.getQuery()Back reference to query, unfortunately required for events.Return the query string of the call.intThe return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.protected ObjectgetValueForInOutParameter(Object parameter, AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Returns value for INOUT parameter.protected ObjectgetValueForInParameter(Object parameter, AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session, boolean shouldBind) INTERNAL: Returns value for IN parameter.booleanReturn true if there are output cursors on this call.booleanThe parameters are the values in order of occurrence in call.booleanThe return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.booleanbooleanReturns true if this call returns from a statement.execute call.booleanReturn whether all the results of the call have been returned.booleanbooleanReturn if the call requires usage of a native (unwrapped) JDBC connection.booleanThe return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.booleanThe return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.static booleanisOutputParameterType(DatasourceCall.ParameterType parameterType) booleanBound calls can have the SQL pre generated.booleanbooleanReturn if the call's return type has been set.booleanbooleanbooleanbooleanbooleanbooleanINTERNAL Indicates whether usesBinding has been set.voidprepare(AbstractSession session) Allow pre-printing of the query/SQL string for fully bound calls, to save from reprinting.voidCursor return is used for cursored streams.voidMany rows are returned for read-all queries.voidNo return is used for modify calls like insert / update / delete.voidOne row is returned for read-object queries.voidIndicates that this call will return a boolean value from an execute() call.voidsetIsNativeConnectionRequired(boolean isNativeConnectionRequired) Set if the call requires usage of a native (unwrapped) JDBC connection.voidsetIsPrepared(boolean isPrepared) Bound calls can have the SQL pre generated.voidsetParameterBindings(List<Boolean> parameterBindings) The parameter binding determines if the specific parameter should be bound.voidsetParameters(List parameters) The parameters are the values in order of occurrence in the SQL statement.voidsetParameterTypes(List<DatasourceCall.ParameterType> parameterTypes) The parameter types determine if the parameter is a modify, translation or literal type.voidsetQuery(DatabaseQuery query) Back reference to query, unfortunately required for events.voidsetQueryString(String queryString) Set the query string of the call.voidsetReturnType(int returnType) The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.voidsetUsesBinding(boolean usesBinding) Set that this call should or shouldn't bind all parametersvoidtranslate(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) Allow the call to translate from the translation for predefined calls.voidINTERNAL: Parse the query string for # markers for custom query based on a query language.voidINTERNAL: Parse the query string for ? markers for custom query based on a query language.voidtranslateQueryString(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Allow the call to translate from the translation for predefined calls.voidtranslateQueryStringAndBindParameters(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Allow the call to translate from the translation for predefined calls.voidtranslateQueryStringForParameterizedIN(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Translate only IN() parameter values (List parameters).INTERNAL Indicates whether usesBinding has been set.booleanusesBinding(DatabasePlatform databasePlatform) Determines if this call should bind all parameters.booleanusesBinding(AbstractSession session) Convenience methodprotected StringINTERNAL: Return the characters that represent non-arguments names.
-
Field Details
-
query
-
parameters
-
parameterTypes
-
parameterBindings
-
usesBinding
The call may specify that all of its parameters should/shouldn't be bound.Typically, this is set to false in the event that the DatabasePlatform marks the call as containing illegal binding behavior during JPQL parsing.
Defaults to null to indicate no preference and allows database platforms to determine
-
isPrepared
protected boolean isPrepared -
isNativeConnectionRequired
protected boolean isNativeConnectionRequiredAllow connection unwrapping to be configured. -
shouldProcessTokenInQuotes
protected boolean shouldProcessTokenInQuotes -
outputCursors
Keep a list of the output cursors. -
returnType
protected int returnType -
NO_RETURN
protected static final int NO_RETURN- See Also:
-
RETURN_ONE_ROW
protected static final int RETURN_ONE_ROW- See Also:
-
RETURN_MANY_ROWS
protected static final int RETURN_MANY_ROWS- See Also:
-
RETURN_CURSOR
protected static final int RETURN_CURSOR- See Also:
-
EXECUTE_UPDATE
protected static final int EXECUTE_UPDATE- See Also:
-
-
Constructor Details
-
DatasourceCall
protected DatasourceCall()
-
-
Method Details
-
getParameters
The parameters are the values in order of occurrence in the SQL statement. This is lazy initialized to conserve space on calls that have no parameters. -
getParameterTypes
The parameter types determine if the parameter is a modify, translation or literal type. -
getParameterBindings
The parameter binding determines if the specific parameter should be bound. -
setParameters
The parameters are the values in order of occurrence in the SQL statement. -
setParameterTypes
The parameter types determine if the parameter is a modify, translation or literal type. -
setParameterBindings
The parameter binding determines if the specific parameter should be bound. -
hasParameters
public boolean hasParameters()The parameters are the values in order of occurrence in call. This is lazy initialized to conserve space on calls that have no parameters. -
getOutputCursors
INTERNAL: Return the output cursors for this stored procedure call. -
hasOutputCursors
public boolean hasOutputCursors()Return true if there are output cursors on this call. -
areManyRowsReturned
public boolean areManyRowsReturned()The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows. -
isOutputParameterType
-
isPrepared
public boolean isPrepared()Bound calls can have the SQL pre generated. -
setIsPrepared
public void setIsPrepared(boolean isPrepared) Bound calls can have the SQL pre generated. -
setUsesBinding
public void setUsesBinding(boolean usesBinding) Set that this call should or shouldn't bind all parameters -
usesBinding
Convenience method- See Also:
-
usesBinding
Determines if this call should bind all parameters.Defaults behavior to the databasePlatform if this call does not have a preference; if
usesBindingis not set- See Also:
-
usesBinding
INTERNAL Indicates whether usesBinding has been set. -
isUsesBindingSet
public boolean isUsesBindingSet()INTERNAL Indicates whether usesBinding has been set. -
buildNewQueryMechanism
Return the appropriate mechanism, with the call added as necessary.- Specified by:
buildNewQueryMechanismin interfaceCall
-
buildQueryMechanism
public DatabaseQueryMechanism buildQueryMechanism(DatabaseQuery query, DatabaseQueryMechanism mechanism) Return the appropriate mechanism, with the call added as necessary.- Specified by:
buildQueryMechanismin interfaceCall
-
clone
Description copied from interface:CallINTERNAL: Return a clone of the call. -
getLogString
Return the SQL string for logging purposes.- Specified by:
getLogStringin interfaceCall
-
getQuery
Back reference to query, unfortunately required for events. -
getReturnType
public int getReturnType()The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows. -
isCursorReturned
public boolean isCursorReturned()The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows. -
isExecuteUpdate
public boolean isExecuteUpdate()Returns true if this call returns from a statement.execute call. -
isFinished
public boolean isFinished()Return whether all the results of the call have been returned.- Specified by:
isFinishedin interfaceCall
-
isNothingReturned
public boolean isNothingReturned()The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.- Specified by:
isNothingReturnedin interfaceCall
-
isOneRowReturned
public boolean isOneRowReturned()The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.- Specified by:
isOneRowReturnedin interfaceCall
-
isSQLCall
public boolean isSQLCall() -
isStoredPLSQLFunctionCall
public boolean isStoredPLSQLFunctionCall() -
isStoredPLSQLProcedureCall
public boolean isStoredPLSQLProcedureCall() -
isStoredFunctionCall
public boolean isStoredFunctionCall() -
isStoredProcedureCall
public boolean isStoredProcedureCall() -
isJPQLCall
public boolean isJPQLCall() -
isEISInteraction
public boolean isEISInteraction() -
isQueryStringCall
public boolean isQueryStringCall() -
prepare
Allow pre-printing of the query/SQL string for fully bound calls, to save from reprinting. -
returnCursor
public void returnCursor()Cursor return is used for cursored streams. -
setExecuteUpdate
public void setExecuteUpdate()Indicates that this call will return a boolean value from an execute() call. -
isReturnSet
public boolean isReturnSet()Return if the call's return type has been set. -
returnManyRows
public void returnManyRows()Many rows are returned for read-all queries. -
returnNothing
public void returnNothing()No return is used for modify calls like insert / update / delete. -
returnOneRow
public void returnOneRow()One row is returned for read-object queries. -
setQuery
Back reference to query, unfortunately required for events. -
setReturnType
public void setReturnType(int returnType) The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows. -
translate
public void translate(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) Allow the call to translate from the translation for predefined calls. -
getQueryString
Return the query string of the call. This must be overwritten by subclasses that support query language translation (SQLCall, XQueryCall). -
setQueryString
Set the query string of the call. This must be overwritten by subclasses that support query language translation (SQLCall, XQueryCall). -
translateCustomQuery
public void translateCustomQuery()INTERNAL: Parse the query string for # markers for custom query based on a query language. This is used by SQLCall and XQuery call, but can be reused by other query languages. -
translatePureSQLCustomQuery
public void translatePureSQLCustomQuery()INTERNAL: Parse the query string for ? markers for custom query based on a query language. This is used by SQLCall and XQuery call, but can be reused by other query languages. -
createField
INTERNAL: Create a new Database Field This method can be overridden by subclasses to return other field types -
appendLiteral
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendTranslation
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendModify
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendIn
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendInOut
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendOut
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call. -
appendLiteral
INTERNAL: -
appendLiteral
INTERNAL: -
appendTranslation
INTERNAL: -
appendTranslation
INTERNAL: -
appendModify
INTERNAL: -
appendModify
INTERNAL: -
appendIn
INTERNAL: -
appendIn
INTERNAL: -
appendInOut
INTERNAL: -
appendInOut
INTERNAL: -
appendInOut
INTERNAL: -
appendInOut
INTERNAL: -
appendOut
INTERNAL: -
appendOut
INTERNAL: -
appendOutCursor
INTERNAL: -
appendOutCursor
INTERNAL: -
appendParameter
public void appendParameter(Writer writer, Object parameter, boolean shouldBind, AbstractSession session) Add the parameter using the DatasourcePlatform. -
argumentMarker
protected char argumentMarker()INTERNAL: Return the character to use for the argument marker. ? is used in SQL, however other query languages such as XQuery need to use other markers. -
whitespace
INTERNAL: Return the characters that represent non-arguments names. -
translateQueryString
public void translateQueryString(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Allow the call to translate from the translation for predefined calls. -
translateQueryStringAndBindParameters
public void translateQueryStringAndBindParameters(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Allow the call to translate from the translation for predefined calls. -
translateQueryStringForParameterizedIN
public void translateQueryStringForParameterizedIN(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Translate only IN() parameter values (List parameters). -
getValueForInParameter
protected Object getValueForInParameter(Object parameter, AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session, boolean shouldBind) INTERNAL: Returns value for IN parameter. Called by translate and translateSQLString methods. In case shouldBind==true tries to return a DatabaseField with type instead of null, returns null only in case no DatabaseField with type was found (case sensitive). -
getValueForInOutParameter
protected Object getValueForInOutParameter(Object parameter, AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session) INTERNAL: Returns value for INOUT parameter. Called by translate and translateSQLString methods. -
createInOutParameter
INTERNAL: Returns INOUT parameter. Called by getValueForInOutParameter method. Descendants may override this method. -
setIsNativeConnectionRequired
public void setIsNativeConnectionRequired(boolean isNativeConnectionRequired) Set if the call requires usage of a native (unwrapped) JDBC connection. This may be required for some Oracle JDBC support when a wrapping DataSource is used. -
isNativeConnectionRequired
public boolean isNativeConnectionRequired()Return if the call requires usage of a native (unwrapped) JDBC connection. This may be required for some Oracle JDBC support when a wrapping DataSource is used.
-