org.eclipse.persistence.queries
Class SQLCall

java.lang.Object
  extended by org.eclipse.persistence.internal.databaseaccess.DatasourceCall
      extended by org.eclipse.persistence.internal.databaseaccess.DatabaseCall
          extended by org.eclipse.persistence.queries.SQLCall
All Implemented Interfaces:
Serializable, Cloneable, org.eclipse.persistence.internal.databaseaccess.QueryStringCall, Call

public class SQLCall
extends org.eclipse.persistence.internal.databaseaccess.DatabaseCall
implements org.eclipse.persistence.internal.databaseaccess.QueryStringCall

Purpose: Used as an abstraction of an SQL call. A call is an SQL string with parameters.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatabaseCall
FIRSTRESULT_FIELD, MAXROW_FIELD
 
Fields inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourceCall
CUSTOM_MODIFY, IN, INOUT, LITERAL, MODIFY, OUT, OUT_CURSOR, TRANSLATION
 
Constructor Summary
SQLCall()
          PUBLIC: Create a new SQL call.
SQLCall(String sqlString)
          PUBLIC: Create a new SQL call.
 
Method Summary
 void appendTranslationParameter(Writer writer, org.eclipse.persistence.internal.expressions.ParameterExpression expression, org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform, org.eclipse.persistence.internal.sessions.AbstractRecord record)
          INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
 boolean hasCustomSQLArguments()
          INTERNAL: Used to avoid misiterpreting the # in custom SQL.
 boolean isQueryStringCall()
          Should return true.
 boolean isSQLCall()
           
 void setCustomSQLArgumentType(String customParameterName, 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).
 void setCustomSQLArgumentType(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).
 void setCustomSQLArgumentType(String argumentFieldName, int type, 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).
 void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, 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).
 void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, Class javaType, org.eclipse.persistence.internal.helper.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).
 void setCustomSQLArgumentType(String argumentFieldName, int type, String typeName, org.eclipse.persistence.internal.helper.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).
 void setHasCustomSQLArguments(boolean hasCustomSQLArguments)
          INTERNAL: Used to avoid misiterpreting the # in custom SQL.
 void setSQLString(String sqlString)
          Set the SQL string.
 void translateCustomQuery()
          INTERNAL: Keep track of the fact that this call has been translated.
 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
 void useCustomSQLCursorOutputAsResultSet(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, appendIn, appendInOut, appendInOut, appendLogParameters, appendOut, appendOutCursor, appendParameter, bindParameter, buildNewQueryMechanism, buildOutputRow, buildQueryMechanism, getCallString, getContexts, getCursorOutIndex, getFields, getFirstResult, getLogString, getMaxRows, getOutputRowFields, getQueryString, getQueryTimeout, getResult, getResultSetConcurrency, getResultSetFetchSize, getResultSetType, getReturnsResultSet, getSQLString, getStatement, hasOptimisticLock, isCursorOutputProcedure, isCursorReturned, isFieldMatchingRequired, isFinished, isLOBLocatorNeeded, isNonCursorOutputProcedure, isResultSetScrollable, isUsesBindingSet, matchFieldOrder, prepare, prepareStatement, setContexts, setFields, setFirstResult, setHasOptimisticLock, setIgnoreFirstRowSetting, setIgnoreMaxResultsSetting, setIsCursorOutputProcedure, setIsFieldMatchingRequired, setIsResultSetScrollable, setMaxRows, setQueryString, setQueryTimeout, setResult, setResultSetConcurrency, setResultSetFetchSize, setResultSetType, setReturnsResultSet, setShouldCacheStatement, setStatement, setUsesBinding, shouldBuildOutputRow, shouldCacheStatement, shouldCacheStatement, shouldIgnoreFirstRowSetting, shouldIgnoreMaxResultsSetting, toString, translate, translateQueryStringForParameterizedIN, usesBinding, usesBinding, useUnnamedCursorOutputAsResultSet
 
Methods inherited from class org.eclipse.persistence.internal.databaseaccess.DatasourceCall
appendIn, appendInOut, appendLiteral, appendModify, appendOut, appendTranslation, areManyRowsReturned, clone, getParameters, getParameterTypes, getQuery, getReturnType, hasParameters, isEISInteraction, isJPQLCall, isNativeConnectionRequired, isNothingReturned, isOneRowReturned, isOutputParameterType, isReturnSet, isStoredFunctionCall, isStoredProcedureCall, returnCursor, returnManyRows, returnNothing, returnOneRow, setIsNativeConnectionRequired, setParameters, setParameterTypes, setQuery, setReturnType, translateQueryString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.persistence.internal.databaseaccess.QueryStringCall
appendLiteral, appendModify, appendParameter, appendTranslation, getParameters, getParameterTypes, getQueryString, hasParameters, prepare, setQueryString, translate, translateQueryString
 
Methods inherited from interface org.eclipse.persistence.queries.Call
buildNewQueryMechanism, buildQueryMechanism, clone, getLogString, isFinished
 

Constructor Detail

SQLCall

public SQLCall()
PUBLIC: Create a new SQL call.


SQLCall

public SQLCall(String sqlString)
PUBLIC: Create a new SQL call. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

Method Detail

hasCustomSQLArguments

public boolean hasCustomSQLArguments()
INTERNAL: Used to avoid misiterpreting the # in custom SQL.


isSQLCall

public boolean isSQLCall()
Overrides:
isSQLCall in class org.eclipse.persistence.internal.databaseaccess.DatasourceCall

isQueryStringCall

public boolean isQueryStringCall()
Description copied from interface: org.eclipse.persistence.internal.databaseaccess.QueryStringCall
Should return true.

Specified by:
isQueryStringCall in interface org.eclipse.persistence.internal.databaseaccess.QueryStringCall
Overrides:
isQueryStringCall in class org.eclipse.persistence.internal.databaseaccess.DatasourceCall

setHasCustomSQLArguments

public void setHasCustomSQLArguments(boolean hasCustomSQLArguments)
INTERNAL: Used to avoid misiterpreting the # in custom SQL.


setCustomSQLArgumentType

public void setCustomSQLArgumentType(String customParameterName,
                                     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(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(String argumentFieldName,
                                     int type,
                                     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). 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.


setCustomSQLArgumentType

public void setCustomSQLArgumentType(String argumentFieldName,
                                     int type,
                                     String typeName,
                                     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(String argumentFieldName,
                                     int type,
                                     String typeName,
                                     org.eclipse.persistence.internal.helper.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(String argumentFieldName,
                                     int type,
                                     String typeName,
                                     Class javaType,
                                     org.eclipse.persistence.internal.helper.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(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:
translateCustomQuery in interface org.eclipse.persistence.internal.databaseaccess.QueryStringCall
Overrides:
translateCustomQuery in class org.eclipse.persistence.internal.databaseaccess.DatasourceCall

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:
translatePureSQLCustomQuery in class org.eclipse.persistence.internal.databaseaccess.DatasourceCall

appendTranslationParameter

public void appendTranslationParameter(Writer writer,
                                       org.eclipse.persistence.internal.expressions.ParameterExpression expression,
                                       org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform,
                                       org.eclipse.persistence.internal.sessions.AbstractRecord record)
                                throws IOException
INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.

Throws:
IOException

useCustomSQLCursorOutputAsResultSet

public void useCustomSQLCursorOutputAsResultSet(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.