public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals)
throws QueryMetadataException, QueryResolverException, TeiidComponentException {
if (command instanceof TriggerAction) {
TriggerAction ta = (TriggerAction)command;
resolveBlock(new CreateUpdateProcedureCommand(), ta.getBlock(), ta.getExternalGroupContexts(), metadata);
return;
}
CreateUpdateProcedureCommand procCommand = (CreateUpdateProcedureCommand) command;
//by creating a new group context here it means that variables will resolve with a higher precedence than input/changing
GroupContext externalGroups = command.getExternalGroupContexts();
List<ElementSymbol> symbols = new LinkedList<ElementSymbol>();
// virtual group elements in HAS and TRANSLATE criteria have to be resolved
if(procCommand.isUpdateProcedure()){
resolveVirtualGroupElements(procCommand, metadata);
//add the default variables
String countVar = ProcedureReservedWords.VARIABLES + ElementSymbol.SEPARATOR + ProcedureReservedWords.ROWS_UPDATED;
ElementSymbol updateCount = new ElementSymbol(countVar);
updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER);
symbols.add(updateCount);
}
String countVar = ProcedureReservedWords.VARIABLES + ElementSymbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT;
ElementSymbol updateCount = new ElementSymbol(countVar);
updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER);
symbols.add(updateCount);
ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, metadata.getMetadataStore(), externalGroups, symbols);
resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata);
}