use of org.apache.derby.shared.common.error.StandardException 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.shared.common.error.StandardException in project derby by apache.
the class EmbedCallableStatement method getTime.
/**
* @see CallableStatement#getTime
* @exception SQLException NoOutputParameters thrown.
*/
public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
checkStatus();
try {
Time v = getParms().getParameterForGet(parameterIndex - 1).getTime(cal);
wasNull = (v == null);
return v;
} catch (StandardException e) {
throw EmbedResultSet.noStateChangeException(e);
}
}
use of org.apache.derby.shared.common.error.StandardException 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.shared.common.error.StandardException 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);
}
}
use of org.apache.derby.shared.common.error.StandardException in project derby by apache.
the class DataDictionaryImpl method debugGenerateInfo.
private void debugGenerateInfo(StringBuffer strbuf, TransactionController tc, ConglomerateController heapCC, TabInfoImpl ti, int indexId) {
if (SanityManager.DEBUG) {
try {
strbuf.append("\nadditional information: ");
// print the lock table
// will get a NullPointerException if lcc doesn't yet exist e.g. at boot time
LanguageConnectionContext lcc = (LanguageConnectionContext) getContext(LanguageConnectionContext.CONTEXT_ID);
if (lcc != null) {
long currentTime = System.currentTimeMillis();
// EXCLUDE-START-lockdiag-
Enumeration lockTable = lockFactory.makeVirtualLockTable();
String lockTableString = Timeout.buildString(lockTable, currentTime);
strbuf.append("lock table at time of failure\n\n");
strbuf.append(lockTableString);
// EXCLUDE-END-lockdiag-
}
// consistency checking etc.
ConglomerateController btreeCC = tc.openConglomerate(ti.getIndexConglomerate(indexId), false, 0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ);
btreeCC.debugConglomerate();
heapCC.debugConglomerate();
heapCC.checkConsistency();
strbuf.append("\nheapCC.checkConsistency() = true");
ConglomerateController indexCC = tc.openConglomerate(ti.getIndexConglomerate(indexId), false, 0, TransactionController.MODE_TABLE, TransactionController.ISOLATION_REPEATABLE_READ);
indexCC.checkConsistency();
strbuf.append("\nindexCC.checkConsistency() = true");
System.err.println("ASSERT FAILURE: " + strbuf.toString());
System.out.println("ASSERT FAILURE: " + strbuf.toString());
SanityManager.DEBUG_PRINT("ASSERT FAILURE", strbuf.toString());
} catch (StandardException se) {
strbuf.append("\ngot the following error when doing extra consistency checks:\n" + se.toString());
}
}
}
Aggregations