}
continue;
}
// Go through the StmtParameters and map values from ProcParameters
StmtParameter stmt_params[] = catalog_stmt.getParameters().values();
Object stmt_args[] = new Object[stmt_params.length]; // this.getStatementParamsArray(catalog_stmt);
boolean stmt_args_set = false;
// XXX: This method may return null because it's being used for other
// purposes in the BatchPlanner.
int stmt_args_offsets[] = this.p_estimator.getStatementEstimationParameters(catalog_stmt);
if (stmt_args_offsets == null) {
stmt_args_offsets = new int[stmt_args.length];
for (int i = 0; i < stmt_args.length; i++)
stmt_args_offsets[i] = i;
}
assert(stmt_args_offsets != null) :
"Unexpected null StmtParameter offsets for " + catalog_stmt.fullName();
for (int offset : stmt_args_offsets) {
StmtParameter catalog_stmt_param = stmt_params[offset];
assert(catalog_stmt_param != null);
if (trace.val)
LOG.trace("Retrieving ParameterMappings for " + catalog_stmt_param.fullName());
Collection<ParameterMapping> mappings = stmtMappings.get(catalog_stmt_param);
if (mappings == null || mappings.isEmpty()) {
if (trace.val)
LOG.trace("No parameter mappings exists for " + catalog_stmt_param.fullName());
continue;
}
if (debug.val)
LOG.debug("Found " + mappings.size() + " mapping(s) for " + catalog_stmt_param.fullName());
// Special Case:
// If the number of possible Statements we could execute next is greater than one,
// then we need to prune our list by removing those Statements who have a StmtParameter
// that are correlated to a ProcParameter that doesn't exist (such as referencing an
// array element that is greater than the size of that current array)
// TODO: For now we are just going always pick the first mapping
// that comes back. Is there any choice that we would need to make in order
// to have a better prediction about what the transaction might do?
if (debug.val && mappings.size() > 1) {
LOG.warn("Multiple parameter mappings for " + catalog_stmt_param.fullName());
if (trace.val) {
int ctr = 0;
for (ParameterMapping m : mappings) {
LOG.trace("[" + (ctr++) + "] Mapping: " + m);
} // FOR