Skip navigation links
oracle.toplink.essentials.internal.databaseaccess

Class DatabaseCall

    • Field Detail

      • statement

        protected transient java.sql.Statement statement
      • result

        protected transient java.sql.ResultSet result
      • usesBinding

        protected int usesBinding
      • shouldCacheStatement

        protected int shouldCacheStatement
      • fields

        protected transient java.util.Vector fields
      • isFieldMatchingRequired

        protected boolean isFieldMatchingRequired
      • hasOptimisticLock

        protected boolean hasOptimisticLock
      • isResultSetScrollable

        protected boolean isResultSetScrollable
      • resultSetType

        protected int resultSetType
      • resultSetConcurrency

        protected int resultSetConcurrency
      • queryTimeout

        protected int queryTimeout
      • maxRows

        protected int maxRows
      • firstResult

        protected int firstResult
      • isCursorOutputProcedure

        protected boolean isCursorOutputProcedure
      • returnsResultSet

        protected int returnsResultSet
      • shouldBuildOutputRow

        protected boolean shouldBuildOutputRow
      • isCallableStatementRequired

        protected boolean isCallableStatementRequired
      • sqlString

        protected java.lang.String sqlString
    • Constructor Detail

      • DatabaseCall

        public DatabaseCall()
    • Method Detail

      • appendIn

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

        public void appendInOut(DatabaseField inoutField)
        INTERNAL:
      • appendInOut

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

        public void appendOut(DatabaseField outField)
        INTERNAL:
      • appendOutCursor

        public void appendOutCursor(DatabaseField outField)
        INTERNAL:
      • appendParameter

        public void appendParameter(java.io.Writer writer,
                                    java.lang.Object parameter,
                                    AbstractSession session)
        Add the parameter. If using binding bind the parameter otherwise let the platform print it. The platform may also decide to bind the value.
        Overrides:
        appendParameter in class DatasourceCall
      • bindParameter

        public void bindParameter(java.io.Writer writer,
                                  java.lang.Object parameter)
        Bind the parameter. Binding is determined by the call and second the platform.
      • buildOutputRow

        public AbstractRecord buildOutputRow(java.sql.CallableStatement statement)
                                      throws java.sql.SQLException
        INTERNAL: Return DatabaseRow containing output fields and values. Called only if shouldBuildOutputRow method returns true.
        Throws:
        java.sql.SQLException
      • createInOutParameter

        protected java.lang.Object createInOutParameter(java.lang.Object inValue,
                                                        java.lang.Object outParameter,
                                                        AbstractSession session)
        INTERNAL: Returns INOUT parameter. The first parameter is value to pass in, the second DatabaseField for out.
        Overrides:
        createInOutParameter in class DatasourceCall
      • getCallString

        public java.lang.String getCallString()
        INTERNAL: Return the SQL string for the call.
      • getFields

        public java.util.Vector getFields()
        The fields expected by the calls result set. null means that the fields are unknown and should be built from the result set.
      • getFieldWithTypeFromDescriptor

        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).
      • getCursorOutIndex

        public int getCursorOutIndex()
        INTERNAL: Return 1-based index of out cursor parameter, or -1.
      • getFirstResult

        public int getFirstResult()
        get first result
      • appendLogParameters

        public static void appendLogParameters(java.util.Collection parameters,
                                               Accessor accessor,
                                               java.io.StringWriter writer,
                                               AbstractSession session)
        Print the parameters to the write for logging purposes.
      • getMaxRows

        public int getMaxRows()
        get max rows returned from the call
      • getOutputRowFields

        public java.util.Vector getOutputRowFields()
        INTERNAL Returns the fields to be used in output row.
      • getQueryString

        public java.lang.String getQueryString()
        INTERNAL: Return the query string (SQL) of the call.
        Overrides:
        getQueryString in class DatasourceCall
      • getResult

        public java.sql.ResultSet getResult()
        The result set is stored for the return value of cursor selects.
      • getReturnsResultSet

        public 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. The result of the method corresponds to false, true.
      • getResultSetConcurrency

        public int getResultSetConcurrency()
      • getResultSetType

        public int getResultSetType()
      • getSQLString

        public java.lang.String getSQLString()
        Return the SQL string that will be executed.
      • getStatement

        public java.sql.Statement getStatement()
        The statement is stored for the return value of cursor selects.
      • hasOptimisticLock

        public boolean hasOptimisticLock()
        This check is needed only when doing batch writing.
      • isCallableStatementRequired

        protected boolean isCallableStatementRequired()
        Callable statement is required if there is an output parameter.
      • isDynamicCall

        protected boolean isDynamicCall(AbstractSession session)
        Return if the call is dynamic SQL call. This means the call has no parameters, is not using binding, is not a stored procedure (CallableStatement), or cursor. This means that a Statement, not PrepareStatement will be used for the call.
      • isCursorOutputProcedure

        public boolean isCursorOutputProcedure()
        Used for Oracle result sets through procedures.
      • isCursorReturned

        public boolean isCursorReturned()
        The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows.
        Overrides:
        isCursorReturned in class DatasourceCall
      • isFieldMatchingRequired

        public boolean isFieldMatchingRequired()
        Return if field matching is required. Field matching is required for custom SQL statements where the result set field order is not known.
      • isFinished

        public boolean isFinished()
        Return whether all the results of the call have been returned.
        Specified by:
        isFinished in interface Call
        Overrides:
        isFinished in class DatasourceCall
      • isNonCursorOutputProcedure

        public boolean isNonCursorOutputProcedure()
        Return true for procedures with any output (or in/out) parameters and no cursors
      • isResultSetScrollable

        public boolean isResultSetScrollable()
      • matchFieldOrder

        public void matchFieldOrder(java.sql.ResultSet resultSet,
                                    DatabaseAccessor accessor,
                                    AbstractSession session)
        Allow for the field order to be matched if required. This is required for custom SQL.
      • prepare

        public void prepare(AbstractSession session)
        INTERNAL: Allow pre-printing of the SQL string for fully bound calls, to save from reprinting. Should be called before translation.
        Overrides:
        prepare in class DatasourceCall
      • prepareInternal

        protected void prepareInternal(AbstractSession session)
        INTERNAL: Called by prepare method only. May be overridden.
      • prepareStatement

        public java.sql.Statement prepareStatement(DatabaseAccessor accessor,
                                                   AbstractRecord translationRow,
                                                   AbstractSession session)
                                            throws java.sql.SQLException
        INTERNAL: Prepare the JDBC statement, this may be parameterize or a call statement. If caching statements this must check for the pre-prepared statement and re-bind to it.
        Throws:
        java.sql.SQLException
      • setFields

        public void setFields(java.util.Vector fields)
        The fields expected by the calls result set.
      • setFirstResult

        public void setFirstResult(int firstResult)
        The firstResult set on the result set
      • setHasOptimisticLock

        public void setHasOptimisticLock(boolean hasOptimisticLock)
        This check is needed only when doing batch writing and we hit on optimistic locking.
      • setIsCallableStatementRequired

        protected void setIsCallableStatementRequired(boolean isCallableStatementRequired)
        Callable statement is required if there is an output parameter.
      • setIsCursorOutputProcedure

        public void setIsCursorOutputProcedure(boolean isCursorOutputProcedure)
        Used for Oracle result sets through procedures.
      • setIsFieldMatchingRequired

        public void setIsFieldMatchingRequired(boolean isFieldMatchingRequired)
        Field matching is required for custom SQL statements where the result set field order is not known.
      • setIsResultSetScrollable

        public void setIsResultSetScrollable(boolean isResultSetScrollable)
      • setMaxRows

        public void setMaxRows(int maxRows)
        set query max returned row size to the JDBC Statement
      • setQueryString

        public void setQueryString(java.lang.String queryString)
        INTERNAL: Set the query string (SQL) of the call.
        Overrides:
        setQueryString in class DatasourceCall
      • setResult

        public void setResult(java.sql.ResultSet result)
        The result set is stored for the return value of cursor selects.
      • setResultSetConcurrency

        public void setResultSetConcurrency(int resultSetConcurrency)
      • setSQLStringInternal

        protected void setSQLStringInternal(java.lang.String sqlString)
        INTERNAL: Set the SQL string.
      • setResultSetType

        public void setResultSetType(int resultSetType)
      • setReturnsResultSet

        public void setReturnsResultSet(boolean returnsResultSet)
        PUBLIC: Use this method to tell TopLink that the stored procedure will be returning a JDBC ResultSet
      • setShouldBuildOutputRow

        protected void setShouldBuildOutputRow(boolean shouldBuildOutputRow)
        INTERNAL: Set whether the call has to build output row
      • setShouldCacheStatement

        public void setShouldCacheStatement(boolean shouldCacheStatement)
        Bound calls can use prepared statement caching.
      • setStatement

        public void setStatement(java.sql.Statement statement)
        The statement is stored for the return value of cursor selects.
      • setUsesBinding

        public void setUsesBinding(boolean usesBinding)
        The call may specify that its parameters should be bound.
      • shouldBuildOutputRow

        public boolean shouldBuildOutputRow()
        Set whether the call has to build output row
      • shouldCacheStatement

        public boolean shouldCacheStatement(AbstractSession session)
        Bound calls can use prepared statement caching.
      • shouldCacheStatement

        public boolean shouldCacheStatement(DatabasePlatform databasePlatform)
        Bound calls can use prepared statement caching.
      • toString

        public java.lang.String toString()
        INTERNAL: Print the SQL string.
        Overrides:
        toString in class java.lang.Object
      • usesBinding

        public boolean usesBinding(AbstractSession session)
        The call may specify that its parameters should be bound.
      • usesBinding

        public boolean usesBinding(DatabasePlatform databasePlatform)
        The call may specify that its parameters should be bound.
      • isLOBLocatorNeeded

        public boolean isLOBLocatorNeeded()
        INTERNAL: Return if the locator is required for the LOB (BLOB and CLOB) writing.
      • addContext

        public void addContext(DatabaseField field,
                               java.lang.Object value)
        INTERNAL: Add a field - value pair for LOB field into the context.
      • getContexts

        public AbstractRecord getContexts()
        INTERNAL: Return the contexts (for LOB)
      • setContexts

        public void setContexts(AbstractRecord contexts)
        INTERNAL: Set the contexts (for LOB)
      • useUnnamedCursorOutputAsResultSet

        public void useUnnamedCursorOutputAsResultSet()
        PUBLIC: Used for Oracle result sets through procedures. The first OUT parameter is set as a cursor output.