Package org.eclipse.persistence.queries
Class SQLCall
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.DatasourceCall
-
- org.eclipse.persistence.internal.databaseaccess.DatabaseCall
-
- org.eclipse.persistence.queries.SQLCall
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,QueryStringCall,Call
public class SQLCall extends DatabaseCall implements QueryStringCall
Purpose: Used as an abstraction of an SQL call. A call is an SQL string with parameters.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourceCall
DatasourceCall.ParameterType
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanhasCustomSQLArgumentsprotected booleanisTranslatedCustomQuery-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabaseCall
executeReturnValue, fields, fieldsArray, firstResult, FIRSTRESULT_FIELD, generatedKeys, hasAllocatedConnection, hasMultipleResultSets, hasOptimisticLock, ignoreFirstRowSetting, ignoreMaxResultsSetting, isBatchExecutionSupported, isCallableStatementRequired, isCursorOutputProcedure, isFieldMatchingRequired, isMultipleCursorOutputProcedure, isResultSetScrollable, MAXROW_FIELD, maxRows, queryTimeout, queryTimeoutUnit, result, resultSetConcurrency, resultSetFetchSize, resultSetType, returnMultipleResultSetCollections, returnsResultSet, shouldBuildOutputRow, shouldCacheStatement, shouldReturnGeneratedKeys, sqlString, statement, usesBinding
-
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourceCall
EXECUTE_UPDATE, isNativeConnectionRequired, isPrepared, NO_RETURN, outputCursors, parameterBindings, parameters, parameterTypes, query, RETURN_CURSOR, RETURN_MANY_ROWS, RETURN_ONE_ROW, returnType, shouldProcessTokenInQuotes
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterTranslateCustomQuery(java.util.List updatedParameters, java.util.List<DatasourceCall.ParameterType> updatedParameterTypes)INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.protected DatabaseFieldafterTranslateCustomQueryUpdateParameter(DatabaseField field, int index, DatasourceCall.ParameterType parameterType, java.util.List updatedParameters, java.util.List<DatasourceCall.ParameterType> updatedParameterTypes)INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.voidappendTranslationParameter(java.io.Writer writer, ParameterExpression expression, DatabasePlatform platform, AbstractRecord record)INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.booleanhasCustomSQLArguments()INTERNAL: Used to avoid misinterpreting the # in custom SQL.booleanisQueryStringCall()Should return true.booleanisSQLCall()protected voidprepareInternal(AbstractSession session)INTERNAL: Called by prepare method only.voidsetCustomSQLArgumentType(java.lang.String argumentFieldName, int type)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, java.lang.Class javaType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, java.lang.Class javaType, DatabaseField nestedType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, DatabaseField nestedType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetCustomSQLArgumentType(java.lang.String customParameterName, java.lang.Class type)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).voidsetHasCustomSQLArguments(boolean hasCustomSQLArguments)INTERNAL: Used to avoid misinterpreting the # in custom SQL.voidsetSQLString(java.lang.String sqlString)Set the SQL string.voidtranslateCustomQuery()INTERNAL: Keep track of the fact that this call has been translated.voidtranslatePureSQLCustomQuery()INTERNAL: Only translate the call if it was not previously translated This code ensures the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclassvoiduseCustomSQLCursorOutputAsResultSet(java.lang.String customParameterName)PUBLIC: This method should only be used with custom SQL: Used for Oracle result sets through procedures.-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatabaseCall
addContext, appendLogParameters, appendParameter, bindParameter, buildNewQueryMechanism, buildOutputRow, buildQueryMechanism, createInOutParameter, getCallString, getContexts, getCursorOutIndex, getExecuteReturnValue, getFields, getFieldsArray, getFieldWithTypeFromDescriptor, getFirstResult, getGeneratedKeys, getLogString, getMaxRows, getOutputParameterValue, getOutputParameterValue, getOutputRowFields, getQueryString, getQueryTimeout, getResult, getResultSetConcurrency, getResultSetFetchSize, getResultSetType, getReturnsResultSet, getSQLString, getStatement, hasAllocatedConnection, hasMultipleResultSets, hasOptimisticLock, isBatchExecutionSupported, isCallableStatementRequired, isCursorOutputProcedure, isCursorReturned, isDynamicCall, isFieldMatchingRequired, isFinished, isLOBLocatorNeeded, isMultipleCursorOutputProcedure, isNonCursorOutputProcedure, isResultSetScrollable, matchFieldOrder, prepare, prepareInternalParameters, prepareStatement, returnMultipleResultSetCollections, setBatchExecutionSupported, setContexts, setExecuteReturnValue, setFields, setFirstResult, setGeneratedKeys, setHasAllocatedConnection, setHasMultipleResultSets, setHasOptimisticLock, setIgnoreFirstRowSetting, setIgnoreMaxResultsSetting, setIsCallableStatementRequired, setIsCursorOutputProcedure, setIsFieldMatchingRequired, setIsMultipleCursorOutputProcedure, setIsResultSetScrollable, setMaxRows, setQueryString, setQueryTimeout, setQueryTimeoutUnit, setResult, setResultSetConcurrency, setResultSetFetchSize, setResultSetType, setReturnMultipleResultSetCollections, setReturnsResultSet, setShouldBuildOutputRow, setShouldCacheStatement, setShouldReturnGeneratedKeys, setSQLStringInternal, setStatement, shouldBuildOutputRow, shouldCacheStatement, shouldCacheStatement, shouldIgnoreFirstRowSetting, shouldIgnoreMaxResultsSetting, shouldReturnGeneratedKeys, toString, translate, useUnnamedCursorOutputAsResultSet
-
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourceCall
appendIn, appendIn, appendIn, appendInOut, appendInOut, appendInOut, appendInOut, appendInOut, appendLiteral, appendLiteral, appendLiteral, appendModify, appendModify, appendModify, appendOut, appendOut, appendOut, appendOutCursor, appendOutCursor, appendTranslation, appendTranslation, appendTranslation, areManyRowsReturned, argumentMarker, clone, createField, getOutputCursors, getParameterBindings, getParameters, getParameterTypes, getQuery, getReturnType, getValueForInOutParameter, getValueForInParameter, hasOutputCursors, hasParameters, isEISInteraction, isExecuteUpdate, isJPQLCall, isNativeConnectionRequired, isNothingReturned, isOneRowReturned, isOutputParameterType, isPrepared, isReturnSet, isStoredFunctionCall, isStoredPLSQLFunctionCall, isStoredPLSQLProcedureCall, isStoredProcedureCall, isUsesBindingSet, returnCursor, returnManyRows, returnNothing, returnOneRow, setExecuteUpdate, setIsNativeConnectionRequired, setIsPrepared, setParameterBindings, setParameters, setParameterTypes, setQuery, setReturnType, setUsesBinding, translateQueryString, translateQueryStringAndBindParameters, translateQueryStringForParameterizedIN, usesBinding, usesBinding, usesBinding, whitespace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.queries.Call
buildNewQueryMechanism, buildQueryMechanism, clone, getLogString, isFinished, isNothingReturned, isOneRowReturned
-
Methods inherited from interface org.eclipse.persistence.internal.databaseaccess.QueryStringCall
appendLiteral, appendModify, appendParameter, appendTranslation, getParameterBindings, getParameters, getParameterTypes, getQueryString, hasParameters, prepare, setQueryString, translate, translateQueryString
-
-
-
-
Method Detail
-
afterTranslateCustomQuery
protected void afterTranslateCustomQuery(java.util.List updatedParameters, java.util.List<DatasourceCall.ParameterType> updatedParameterTypes)INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods.
-
afterTranslateCustomQueryUpdateParameter
protected DatabaseField afterTranslateCustomQueryUpdateParameter(DatabaseField field, int index, DatasourceCall.ParameterType parameterType, java.util.List updatedParameters, java.util.List<DatasourceCall.ParameterType> updatedParameterTypes)
INTERNAL: Set the data passed through setCustomSQLArgumentType and useCustomSQLCursorOutputAsResultSet methods. This will return the null if the user did not add the field/type using the setCustomSQLArgumentType method
-
hasCustomSQLArguments
public boolean hasCustomSQLArguments()
INTERNAL: Used to avoid misinterpreting the # in custom SQL.
-
isSQLCall
public boolean isSQLCall()
- Overrides:
isSQLCallin classDatasourceCall
-
isQueryStringCall
public boolean isQueryStringCall()
Description copied from interface:QueryStringCallShould return true.- Specified by:
isQueryStringCallin interfaceQueryStringCall- Overrides:
isQueryStringCallin classDatasourceCall
-
prepareInternal
protected void prepareInternal(AbstractSession session)
INTERNAL: Called by prepare method only.- Overrides:
prepareInternalin classDatabaseCall
-
setHasCustomSQLArguments
public void setHasCustomSQLArguments(boolean hasCustomSQLArguments)
INTERNAL: Used to avoid misinterpreting the # in custom SQL.
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String customParameterName, java.lang.Class type)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string).
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String argumentFieldName, int type)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). The argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter.
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). The argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types.
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, java.lang.Class javaType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible.
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, DatabaseField nestedType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The nestedType is a DatabaseField with type information set to match the VARRAYs object types
-
setCustomSQLArgumentType
public void setCustomSQLArgumentType(java.lang.String argumentFieldName, int type, java.lang.String typeName, java.lang.Class javaType, DatabaseField nestedType)PUBLIC: This method should only be used with custom SQL: it sets a type to IN, OUT or INOUT parameter (prefixed with #, ### or #### in custom SQL string). TThe argumentFieldName is the field or argument name used in the SQL. The type is the JDBC type code for the parameter. The typeName is the JDBC type name, this may be required for ARRAY or STRUCT types. The javaType is the java class to return instead of the ARRAY and STRUCT types if a conversion is possible. The nestedType is a DatabaseField with type information set to match the VARRAYs object types
-
setSQLString
public void setSQLString(java.lang.String sqlString)
Set the SQL string. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.
-
translateCustomQuery
public void translateCustomQuery()
INTERNAL: Keep track of the fact that this call has been translated. This information is used to ensure the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclass- Specified by:
translateCustomQueryin interfaceQueryStringCall- Overrides:
translateCustomQueryin classDatasourceCall
-
translatePureSQLCustomQuery
public void translatePureSQLCustomQuery()
INTERNAL: Only translate the call if it was not previously translated This code ensures the translation code for a custom SQLCall is only run once In the case of inheritance we will try to call the translation code once to get the list of types and again for each subclass- Overrides:
translatePureSQLCustomQueryin classDatasourceCall
-
appendTranslationParameter
public void appendTranslationParameter(java.io.Writer writer, ParameterExpression expression, DatabasePlatform platform, AbstractRecord record) throws java.io.IOExceptionINTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.- Throws:
java.io.IOException
-
useCustomSQLCursorOutputAsResultSet
public void useCustomSQLCursorOutputAsResultSet(java.lang.String customParameterName)
PUBLIC: This method should only be used with custom SQL: Used for Oracle result sets through procedures. It defines OUT parameter (prefixed with ### in custom SQL string) as a cursor output.
-
-