public void addExternalGroupToContext(GroupSymbol group) { getExternalGroupContexts().addGroup(group); }
public void addExternalGroupToContext(GroupSymbol group) { getExternalGroupContexts().addGroup(group); }
public void addExternalGroupToContext(GroupSymbol group) { getExternalGroupContexts().addGroup(group); }
public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
static List<Reference> getReferences(Command command) { List<Reference> boundList = new ArrayList<Reference>(); for (Iterator<Reference> refs = ReferenceCollectorVisitor.getReferences(command).iterator(); refs.hasNext();) { Reference ref = refs.next(); Expression expr = ref.getExpression(); if (!(expr instanceof ElementSymbol)){ continue; } ElementSymbol elem = (ElementSymbol)expr; if (!command.getExternalGroupContexts().getGroups().contains(elem.getGroupSymbol())) { continue; } boundList.add(ref); } return boundList; }
public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
protected void copyMetadataState(Command copy) { if(this.getExternalGroupContexts() != null) { copy.externalGroups = this.externalGroups.clone(); } if(this.tempGroupIDs != null) { copy.setTemporaryMetadata(this.tempGroupIDs.clone()); } copy.plan = this.plan; if (this.correlatedReferences != null) { copy.correlatedReferences = this.correlatedReferences.clone(); } if(this.getOption() != null) { copy.setOption( (Option) this.getOption().clone() ); } copy.cacheHint = this.cacheHint; copy.sourceHint = this.sourceHint; }
protected void copyMetadataState(Command copy) { if(this.getExternalGroupContexts() != null) { copy.externalGroups = this.externalGroups.clone(); } if(this.tempGroupIDs != null) { copy.setTemporaryMetadata(this.tempGroupIDs.clone()); } copy.plan = this.plan; if (this.correlatedReferences != null) { copy.correlatedReferences = this.correlatedReferences.clone(); } if(this.getOption() != null) { copy.setOption( (Option) this.getOption().clone() ); } copy.cacheHint = this.cacheHint; copy.sourceHint = this.sourceHint; }
/** * @see org.teiid.query.resolver.CommandResolver#resolveCommand(org.teiid.query.sql.lang.Command, TempMetadataAdapter, boolean) */ public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals) throws QueryMetadataException, QueryResolverException, TeiidComponentException { //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>(); String countVar = ProcedureReservedWords.VARIABLES + Symbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT; ElementSymbol updateCount = new ElementSymbol(countVar); updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER); symbols.add(updateCount); ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, metadata.getMetadataStore(), externalGroups, symbols); if (command instanceof TriggerAction) { TriggerAction ta = (TriggerAction)command; CreateProcedureCommand cmd = new CreateProcedureCommand(ta.getBlock()); cmd.setVirtualGroup(ta.getView()); //TODO: this is not generally correct - we should update the api to set the appropriate type cmd.setUpdateType(Command.TYPE_INSERT); resolveBlock(cmd, ta.getBlock(), ta.getExternalGroupContexts(), metadata); return; } CreateProcedureCommand procCommand = (CreateProcedureCommand) command; resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata); }
/** * @see org.teiid.query.resolver.CommandResolver#resolveCommand(org.teiid.query.sql.lang.Command, TempMetadataAdapter, boolean) */ public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals) throws QueryMetadataException, QueryResolverException, TeiidComponentException { //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>(); String countVar = ProcedureReservedWords.VARIABLES + Symbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT; ElementSymbol updateCount = new ElementSymbol(countVar); updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER); symbols.add(updateCount); ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, metadata.getMetadataStore(), externalGroups, symbols); if (command instanceof TriggerAction) { TriggerAction ta = (TriggerAction)command; CreateProcedureCommand cmd = new CreateProcedureCommand(ta.getBlock()); cmd.setVirtualGroup(ta.getView()); //TODO: this is not generally correct - we should update the api to set the appropriate type cmd.setUpdateType(Command.TYPE_INSERT); resolveBlock(cmd, ta.getBlock(), ta.getExternalGroupContexts(), metadata); return; } CreateProcedureCommand procCommand = (CreateProcedureCommand) command; resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata); }
/** * @see org.teiid.query.resolver.CommandResolver#resolveCommand(org.teiid.query.sql.lang.Command, TempMetadataAdapter, boolean) */ public void resolveCommand(Command command, TempMetadataAdapter metadata, boolean resolveNullLiterals) throws QueryMetadataException, QueryResolverException, TeiidComponentException { //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>(); String countVar = ProcedureReservedWords.VARIABLES + Symbol.SEPARATOR + ProcedureReservedWords.ROWCOUNT; ElementSymbol updateCount = new ElementSymbol(countVar); updateCount.setType(DataTypeManager.DefaultDataClasses.INTEGER); symbols.add(updateCount); ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.VARIABLES, metadata.getMetadataStore(), externalGroups, symbols); if (command instanceof TriggerAction) { TriggerAction ta = (TriggerAction)command; CreateProcedureCommand cmd = new CreateProcedureCommand(ta.getBlock()); cmd.setVirtualGroup(ta.getView()); //TODO: this is not generally correct - we should update the api to set the appropriate type cmd.setUpdateType(Command.TYPE_INSERT); resolveBlock(cmd, ta.getBlock(), ta.getExternalGroupContexts(), metadata); return; } CreateProcedureCommand procCommand = (CreateProcedureCommand) command; resolveBlock(procCommand, procCommand.getBlock(), externalGroups, metadata); }
protected void copyMetadataState(Command copy) { if(this.getExternalGroupContexts() != null) { copy.externalGroups = (GroupContext)this.externalGroups.clone(); } if(this.tempGroupIDs != null) { copy.setTemporaryMetadata(this.tempGroupIDs.clone()); } copy.setIsResolved(this.isResolved()); copy.plan = this.plan; if (this.correlatedReferences != null) { copy.correlatedReferences = this.correlatedReferences.clone(); } if(this.getOption() != null) { copy.setOption( (Option) this.getOption().clone() ); } copy.cacheHint = this.cacheHint; copy.sourceHint = this.sourceHint; }
currentCommand.getExternalGroupContexts().addGroup(gs);
currentCommand.getExternalGroupContexts().addGroup(gs);
currentCommand.getExternalGroupContexts().addGroup(gs);