Class DatasourceCall

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Call
    Direct Known Subclasses:
    DatabaseCall, EISInteraction

    public abstract class DatasourceCall
    extends java.lang.Object
    implements Call
    INTERNAL: Purpose: Used as an abstraction of a datasource invocation.
    Since:
    OracleAS TopLink 10g (10.0.3)
    Author:
    James Sutherland
    See Also:
    Serialized Form
    • Field Detail

      • parameters

        protected java.util.List<java.lang.Object> parameters
      • parameterBindings

        protected java.util.List<java.lang.Boolean> parameterBindings
      • usesBinding

        protected java.lang.Boolean 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 isNativeConnectionRequired
        Allow connection unwrapping to be configured.
      • shouldProcessTokenInQuotes

        protected boolean shouldProcessTokenInQuotes
      • outputCursors

        protected java.util.List<DatabaseField> outputCursors
        Keep a list of the output cursors.
      • returnType

        protected int returnType
    • Constructor Detail

      • DatasourceCall

        public DatasourceCall()
    • Method Detail

      • getParameters

        public java.util.List 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

        public java.util.List<DatasourceCall.ParameterType> getParameterTypes()
        The parameter types determine if the parameter is a modify, translation or literal type.
      • getParameterBindings

        public java.util.List<java.lang.Boolean> getParameterBindings()
        The parameter binding determines if the specific parameter should be bound.
      • setParameters

        public void setParameters​(java.util.List<java.lang.Object> parameters)
        The parameters are the values in order of occurrence in the SQL statement.
      • setParameterTypes

        public void setParameterTypes​(java.util.List<DatasourceCall.ParameterType> parameterTypes)
        The parameter types determine if the parameter is a modify, translation or literal type.
      • setParameterBindings

        public void setParameterBindings​(java.util.List<java.lang.Boolean> parameterBindings)
        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

        public java.util.List<DatabaseField> 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.
      • 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

        public boolean usesBinding​(AbstractSession session)
        Convenience method
      • usesBinding

        public java.lang.Boolean usesBinding()
        INTERNAL Indicates whether usesBinding has been set.
      • isUsesBindingSet

        public boolean isUsesBindingSet()
        INTERNAL Indicates whether usesBinding has been set.
      • clone

        public java.lang.Object clone()
        Description copied from interface: Call
        INTERNAL: Return a clone of the call.
        Specified by:
        clone in interface Call
        Overrides:
        clone in class java.lang.Object
      • getLogString

        public abstract java.lang.String getLogString​(Accessor accessor)
        Return the SQL string for logging purposes.
        Specified by:
        getLogString in interface Call
      • getQuery

        public DatabaseQuery 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:
        isFinished in interface Call
      • isNothingReturned

        public boolean isNothingReturned()
        The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
        Specified by:
        isNothingReturned in interface Call
      • isOneRowReturned

        public boolean isOneRowReturned()
        The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
        Specified by:
        isOneRowReturned in interface Call
      • 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

        public void prepare​(AbstractSession session)
        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

        public void setQuery​(DatabaseQuery query)
        Back reference to query, unfortunately required for events.
      • setReturnType

        public void setReturnType​(int returnType)
        The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
      • getQueryString

        public java.lang.String getQueryString()
        Return the query string of the call. This must be overwritten by subclasses that support query language translation (SQLCall, XQueryCall).
      • setQueryString

        public void setQueryString​(java.lang.String queryString)
        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

        protected DatabaseField createField​(java.lang.String fieldName)
        INTERNAL: Create a new Database Field This method can be overridden by subclasses to return other field types
      • appendLiteral

        public void appendLiteral​(java.io.Writer writer,
                                  java.lang.Object literal)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendTranslation

        public void appendTranslation​(java.io.Writer writer,
                                      DatabaseField modifyField)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendModify

        public void appendModify​(java.io.Writer writer,
                                 DatabaseField modifyField)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendIn

        public void appendIn​(java.io.Writer writer,
                             DatabaseField field)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendInOut

        public void appendInOut​(java.io.Writer writer,
                                DatabaseField inoutField)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendOut

        public void appendOut​(java.io.Writer writer,
                              DatabaseField outField)
        INTERNAL: All values are printed as ? to allow for parameter binding or translation during the execute of the call.
      • appendLiteral

        public void appendLiteral​(java.lang.Object literal)
        INTERNAL:
      • appendLiteral

        public void appendLiteral​(java.lang.Object literal,
                                  java.lang.Boolean shouldBind)
        INTERNAL:
      • appendTranslation

        public void appendTranslation​(DatabaseField modifyField)
        INTERNAL:
      • appendTranslation

        public void appendTranslation​(DatabaseField modifyField,
                                      java.lang.Boolean shouldBind)
        INTERNAL:
      • appendModify

        public void appendModify​(DatabaseField modifyField)
        INTERNAL:
      • appendModify

        public void appendModify​(DatabaseField modifyField,
                                 java.lang.Boolean shouldBind)
        INTERNAL:
      • appendIn

        public void appendIn​(java.lang.Object inObject)
        INTERNAL:
      • appendIn

        public void appendIn​(java.lang.Object inObject,
                             java.lang.Boolean shouldBind)
        INTERNAL:
      • appendInOut

        public void appendInOut​(DatabaseField inoutField)
        INTERNAL:
      • appendInOut

        public void appendInOut​(DatabaseField inoutField,
                                java.lang.Boolean shouldBind)
        INTERNAL:
      • appendInOut

        public void appendInOut​(java.lang.Object inValueOrField,
                                DatabaseField outField)
        INTERNAL:
      • appendInOut

        public void appendInOut​(java.lang.Object inValueOrField,
                                DatabaseField outField,
                                java.lang.Boolean shouldBind)
        INTERNAL:
      • appendOut

        public void appendOut​(DatabaseField outField)
        INTERNAL:
      • appendOut

        public void appendOut​(DatabaseField outField,
                              java.lang.Boolean shouldBind)
        INTERNAL:
      • appendOutCursor

        public void appendOutCursor​(DatabaseField outField)
        INTERNAL:
      • appendOutCursor

        public void appendOutCursor​(DatabaseField outField,
                                    java.lang.Boolean shouldBind)
        Add the parameter. If using binding bind the parameter otherwise let the platform print it. The platform may also decide to bind the value.
      • appendParameter

        public void appendParameter​(java.io.Writer writer,
                                    java.lang.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

        protected java.lang.String 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 java.lang.Object getValueForInParameter​(java.lang.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 java.lang.Object getValueForInOutParameter​(java.lang.Object parameter,
                                                             AbstractRecord translationRow,
                                                             AbstractRecord modifyRow,
                                                             AbstractSession session)
        INTERNAL: Returns value for INOUT parameter. Called by translate and translateSQLString methods.
      • createInOutParameter

        protected java.lang.Object createInOutParameter​(java.lang.Object inValue,
                                                        java.lang.Object outParameter,
                                                        AbstractSession session)
        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.