Search in sources :

Example 6 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class EmbedCallableStatement method getBoolean.

/**
 * @see CallableStatement#getBoolean
 * @exception SQLException NoOutputParameters thrown.
 */
public boolean getBoolean(int parameterIndex) throws SQLException {
    checkStatus();
    try {
        DataValueDescriptor param = getParms().getParameterForGet(parameterIndex - 1);
        boolean v = param.getBoolean();
        wasNull = (!v) && param.isNull();
        return v;
    } catch (StandardException e) {
        throw EmbedResultSet.noStateChangeException(e);
    }
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 7 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class EmbedCallableStatement method getShort.

/**
 * @see CallableStatement#getShort
 * @exception SQLException NoOutputParameters thrown.
 */
public short getShort(int parameterIndex) throws SQLException {
    checkStatus();
    try {
        DataValueDescriptor param = getParms().getParameterForGet(parameterIndex - 1);
        short s = param.getShort();
        wasNull = (s == 0) && param.isNull();
        return s;
    } catch (StandardException e) {
        throw EmbedResultSet.noStateChangeException(e);
    }
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 8 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class EmbedCallableStatement method executeStatement.

protected final boolean executeStatement(Activation a, boolean executeQuery, boolean executeUpdate) throws SQLException {
    // need this additional check (it's also in the super.executeStatement
    // to ensure we have an activation for the getParams
    checkExecStatus();
    synchronized (getConnectionSynchronization()) {
        wasNull = false;
        // right object to hold the return value from the CallableStatement.
        try {
            getParms().validate();
        } catch (StandardException e) {
            throw EmbedResultSet.noStateChangeException(e);
        }
        /* KLUDGE - ? = CALL ... returns a ResultSet().  We
			 * need executeUpdate to be false in that case.
			 */
        boolean execResult = super.executeStatement(a, executeQuery, (executeUpdate && (!hasReturnOutputParameter)));
        // Fetch the getParms into a local variable now because the
        // activation associated with a CallableStatement at this
        // point(after the executStatement) is the current activation.
        // We can now safely stuff the return value of the
        // CallableStatement into the following ParameterValueSet object.
        ParameterValueSet pvs = getParms();
        /*
			** If we have a return parameter, then we
			** consume it from the returned ResultSet
			** reset the ResultSet set to null.
			*/
        if (hasReturnOutputParameter) {
            if (SanityManager.DEBUG) {
                SanityManager.ASSERT(results != null, "null results even though we are supposed to have a return parameter");
            }
            boolean gotRow = results.next();
            if (SanityManager.DEBUG) {
                SanityManager.ASSERT(gotRow, "the return resultSet didn't have any rows");
            }
            try {
                DataValueDescriptor returnValue = pvs.getReturnValueForSet();
                returnValue.setValueFromResultSet(results, 1, true);
            } catch (StandardException e) {
                throw EmbedResultSet.noStateChangeException(e);
            } finally {
                results.close();
                results = null;
            }
            // This is a form of ? = CALL which current is not a procedure call.
            // Thus there cannot be any user result sets, so return false. execResult
            // is set to true since a result set was returned, for the return parameter.
            execResult = false;
        }
        return execResult;
    }
}
Also used : ParameterValueSet(org.apache.derby.iapi.sql.ParameterValueSet) StandardException(org.apache.derby.shared.common.error.StandardException) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 9 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class EmbedCallableStatement method getFloat.

/**
 * @see CallableStatement#getFloat
 * @exception SQLException NoOutputParameters thrown.
 */
public float getFloat(int parameterIndex) throws SQLException {
    checkStatus();
    try {
        DataValueDescriptor param = getParms().getParameterForGet(parameterIndex - 1);
        float v = param.getFloat();
        wasNull = (v == 0.0) && param.isNull();
        return v;
    } catch (StandardException e) {
        throw EmbedResultSet.noStateChangeException(e);
    }
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Example 10 with DataValueDescriptor

use of org.apache.derby.iapi.types.DataValueDescriptor in project derby by apache.

the class EmbedCallableStatement method getLong.

/**
 * @see CallableStatement#getLong
 * @exception SQLException NoOutputParameters thrown.
 */
public long getLong(int parameterIndex) throws SQLException {
    checkStatus();
    try {
        DataValueDescriptor param = getParms().getParameterForGet(parameterIndex - 1);
        long v = param.getLong();
        wasNull = (v == 0L) && param.isNull();
        return v;
    } catch (StandardException e) {
        throw EmbedResultSet.noStateChangeException(e);
    }
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Aggregations

DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)328 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)72 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)62 RowLocation (org.apache.derby.iapi.types.RowLocation)54 SQLLongint (org.apache.derby.iapi.types.SQLLongint)51 StandardException (org.apache.derby.shared.common.error.StandardException)43 SQLChar (org.apache.derby.iapi.types.SQLChar)42 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)36 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)36 ScanController (org.apache.derby.iapi.store.access.ScanController)35 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)32 UUID (org.apache.derby.catalog.UUID)31 TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)24 RawTransaction (org.apache.derby.iapi.store.raw.xact.RawTransaction)16 DataDescriptorGenerator (org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator)15 RawContainerHandle (org.apache.derby.iapi.store.raw.data.RawContainerHandle)15 DataTypeDescriptor (org.apache.derby.iapi.types.DataTypeDescriptor)15 Properties (java.util.Properties)14 UserType (org.apache.derby.iapi.types.UserType)13 Page (org.apache.derby.iapi.store.raw.Page)11