*/
public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals)
throws QueryMetadataException, QueryResolverException, TeiidComponentException {
if(command.getType() == Command.TYPE_CREATE) {
Create create = (Create)command;
GroupSymbol group = create.getTable();
//assuming that all temp table creates are local, the user must use a local name
if (group.getName().indexOf(ElementSymbol.SEPARATOR) != -1) {
throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.unqualified_name_required", group.getName())); //$NON-NLS-1$
}
//this will only check non-temp groups
Collection exitsingGroups = metadata.getMetadata().getGroupsForPartialName(group.getName());
if(!exitsingGroups.isEmpty()) {
throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.table_already_exists", group.getName())); //$NON-NLS-1$
}
if (metadata.getMetadata().hasProcedure(group.getName())) {
throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.table_already_exists", group.getName())); //$NON-NLS-1$
}
//now we will be more specific for temp groups
TempMetadataID id = metadata.getMetadataStore().getTempGroupID(group.getName());
if (id != null && !metadata.isTemporaryTable(id)) {
throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.table_already_exists", group.getName())); //$NON-NLS-1$
}
//if we get here then either the group does not exist or has already been defined as a temp table
//if it has been defined as a temp table, that's ok we'll use this as the new definition and throw an
//exception at runtime if the user has not dropped the previous table yet
TempMetadataID tempTable = ResolverUtil.addTempTable(metadata, group, create.getColumnSymbols());
ResolverUtil.resolveGroup(create.getTable(), metadata);
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(create.getTable());
ResolverVisitor.resolveLanguageObject(command, groups, metadata);
addAdditionalMetadata(create, tempTable);
} else if(command.getType() == Command.TYPE_DROP) {
ResolverUtil.resolveGroup(((Drop)command).getTable(), metadata);
}