use of org.apache.derby.iapi.services.loader.GeneratedMethod in project derby by apache.
the class DirectCall method getMethod.
public GeneratedMethod getMethod(String simpleName) throws StandardException {
GeneratedMethod rm = methodCache.get(simpleName);
if (rm != null)
return rm;
// Only look for methods that take no arguments
try {
if ((simpleName.length() == 2) && simpleName.startsWith("e")) {
int id = ((int) simpleName.charAt(1)) - '0';
rm = directs[id];
} else {
Method m = getJVMClass().getMethod(simpleName, (Class[]) null);
rm = new ReflectMethod(m);
}
methodCache.put(simpleName, rm);
return rm;
} catch (NoSuchMethodException nsme) {
throw StandardException.newException(SQLState.GENERATED_CLASS_NO_SUCH_METHOD, nsme, getName(), simpleName);
}
}
use of org.apache.derby.iapi.services.loader.GeneratedMethod in project derby by apache.
the class MatchingClauseConstantAction method executeConstantAction.
public void executeConstantAction(Activation activation, TemporaryRowHolderImpl thenRows) throws StandardException {
// nothing to do if no rows qualified
if (thenRows == null) {
return;
}
CursorResultSet sourceRS = thenRows.getResultSet();
GeneratedMethod actionGM = ((BaseActivation) activation).getMethod(_actionMethodName);
//
try {
activation.pushConstantAction(_thenAction);
try {
//
// Poke the temporary table into the variable which will be pushed as
// an argument to the INSERT/UPDATE/DELETE action.
//
Field resultSetField = activation.getClass().getField(_resultSetFieldName);
resultSetField.set(activation, sourceRS);
Activation cursorActivation = sourceRS.getActivation();
//
// Now execute the generated method which creates an InsertResultSet,
// UpdateResultSet, or DeleteResultSet.
//
Method actionMethod = activation.getClass().getMethod(_actionMethodName);
_actionRS = (ResultSet) actionMethod.invoke(activation, null);
} catch (Exception e) {
throw StandardException.plainWrapException(e);
}
// this is where the INSERT/UPDATE/DELETE is processed
_actionRS.open();
} finally {
activation.popConstantAction();
}
}
Aggregations