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);
}
}
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);
}
}
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;
}
}
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);
}
}
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);
}
}
Aggregations