final boolean needNewClass =
gc == null || gc != ps.getActivationClass();
if (needNewClass || !ac.isValid())
{
GeneratedClass newGC;
if (needNewClass) {
// The statement has been re-prepared since the last time
// we executed it. Get the new activation class.
newGC = ps.getActivationClass();
if (newGC == null) {
// There is no class associated with the statement.
// Tell the caller that the statement needs to be
// recompiled.
throw StandardException.newException(
SQLState.LANG_STATEMENT_NEEDS_RECOMPILE);
}
} else {
// Reuse the generated class, we just want a new activation
// since the old is no longer valid.
newGC = gc;
}
/*
** If we get here, it means the Activation has been invalidated
** or the PreparedStatement has been recompiled. Get a new
** Activation and check whether the parameters are compatible.
** If so, transfer the parameters from the old Activation to
** the new one, and make that the current Activation. If not,
** throw an exception.
*/
BaseActivation newAC = (BaseActivation) newGC.newInstance(lcc);
DataTypeDescriptor[] newParamTypes = ps.getParameterTypes();
/*
** Link the new activation to the prepared statement.