/** * Decides whether a command needs to be executed. * <br/><b>NOTE: This method has a side-effect.</b> If the criteria of this command always evaluate to true, * and the simplifyCriteria flag is true, then the command criteria are set to null. * @param command * @param simplifyCriteria whether to simplify the criteria of the command if they always evaluate to true * @return true if this command should be executed by the connector; false otherwise. * @throws TeiidComponentException * @throws ExpressionEvaluationException * @since 4.2 */ public static boolean shouldExecute(Command command, boolean simplifyCriteria) throws TeiidComponentException, ExpressionEvaluationException { return shouldExecute(command, simplifyCriteria, false); }
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { command = (Command)command.clone(); MultiSourceElementReplacementVisitor.visit(sourceName, metadata, command); if (!RelationalNodeUtil.shouldExecute(command, false, true)) { continue; case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
isUpdate = RelationalNodeUtil.isUpdate(command); nextCommand = null; } else { needProcessing = RelationalNodeUtil.shouldExecute(atomicCommand, true);
boolean shouldExecute = false; for (QueryCommand innerQuery : union.getQueryCommands()) { boolean shouldInner = shouldExecute(innerQuery, simplifyCriteria, duringPlanning); if(shouldInner) { shouldExecute = true; criteria = query.getCriteria(); boolean shouldEvaluate = shouldEvaluate(simplifyCriteria, duringPlanning, criteria, query, false); shouldEvaluate = shouldEvaluate(simplifyCriteria, duringPlanning, query.getHaving(), query, true); QueryCommand expr = insert.getQueryExpression(); if (expr != null) { return shouldExecute(expr, simplifyCriteria);
if (connectorManager == null) { if (RelationalNodeUtil.hasOutputParams(command)) { throw new AssertionError("A source is required to execute a procedure returning parameters"); //$NON-NLS-1$
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { command = (Command)command.clone(); MultiSourceElementReplacementVisitor.visit(sourceName, metadata, command); if (!RelationalNodeUtil.shouldExecute(command, false, true)) { continue; case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
isUpdate = RelationalNodeUtil.isUpdate(command); nextCommand = null; } else { needProcessing = RelationalNodeUtil.shouldExecute(atomicCommand, true);
boolean shouldExecute = false; for (QueryCommand innerQuery : union.getQueryCommands()) { boolean shouldInner = shouldExecute(innerQuery, simplifyCriteria, duringPlanning); if(shouldInner) { shouldExecute = true; criteria = query.getCriteria(); boolean shouldEvaluate = shouldEvaluate(simplifyCriteria, duringPlanning, criteria, query, false); shouldEvaluate = shouldEvaluate(simplifyCriteria, duringPlanning, query.getHaving(), query, true); QueryCommand expr = insert.getQueryExpression(); if (expr != null) { return shouldExecute(expr, simplifyCriteria);
if (connectorManager == null) { if (RelationalNodeUtil.hasOutputParams(command)) { throw new AssertionError("A source is required to execute a procedure returning parameters"); //$NON-NLS-1$
/** * Decides whether a command needs to be executed. * <br/><b>NOTE: This method has a side-effect.</b> If the criteria of this command always evaluate to true, * and the simplifyCriteria flag is true, then the command criteria are set to null. * @param command * @param simplifyCriteria whether to simplify the criteria of the command if they always evaluate to true * @return true if this command should be executed by the connector; false otherwise. * @throws TeiidComponentException * @throws ExpressionEvaluationException * @since 4.2 */ public static boolean shouldExecute(Command command, boolean simplifyCriteria) throws TeiidComponentException, ExpressionEvaluationException { return shouldExecute(command, simplifyCriteria, false); }
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { command = (Command)command.clone(); MultiSourceElementReplacementVisitor.visit(sourceName, metadata, command); if (!RelationalNodeUtil.shouldExecute(command, false, true)) { continue; case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
private void checkForUpdates(AtomicResultsMessage results, Command command, EventDistributor distributor, int commandIndex, long ts) { if (!RelationalNodeUtil.isUpdate(command) || !(command instanceof ProcedureContainer)) { return; } ProcedureContainer pc = (ProcedureContainer)command; GroupSymbol gs = pc.getGroup(); Integer zero = Integer.valueOf(0); if (results.getResults().length <= commandIndex || zero.equals(results.getResults()[commandIndex].get(0))) { return; } Object metadataId = gs.getMetadataID(); if (metadataId == null) { return; } if (!(metadataId instanceof Table)) { if (metadataId instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataId; if (tid.getTableData().getModel() != null) { tid.getTableData().dataModified((Integer)results.getResults()[commandIndex].get(0)); } } return; } Table t = (Table)metadataId; t.setLastDataModification(ts); if (distributor != null) { distributor.dataModification(this.workItem.getDqpWorkContext().getVdbName(), this.workItem.getDqpWorkContext().getVdbVersion(), t.getParent().getName(), t.getName()); } }
isUpdate = RelationalNodeUtil.isUpdate(command); nextCommand = null; } else { needProcessing = RelationalNodeUtil.shouldExecute(atomicCommand, true);
if (connectorManager == null) { if (RelationalNodeUtil.hasOutputParams(command)) { throw new AssertionError("A source is required to execute a procedure returning parameters"); //$NON-NLS-1$
/** * Decides whether a command needs to be executed. * <br/><b>NOTE: This method has a side-effect.</b> If the criteria of this command always evaluate to true, * and the simplifyCriteria flag is true, then the command criteria are set to null. * @param command * @param simplifyCriteria whether to simplify the criteria of the command if they always evaluate to true * @return true if this command should be executed by the connector; false otherwise. * @throws TeiidComponentException * @throws ExpressionEvaluationException * @since 4.2 */ public static boolean shouldExecute(Command command, boolean simplifyCriteria) throws TeiidComponentException, ExpressionEvaluationException { return shouldExecute(command, simplifyCriteria, false); }
return true; if (transactionalReads || RelationalNodeUtil.isUpdate(command) || (command instanceof StoredProcedure && ((StoredProcedure)command).getUpdateCount() != 0)) { if ((multiSource && connectorBindingExpression == null)) { return true;
protected boolean prepareNextCommand(Command atomicCommand) throws TeiidComponentException, TeiidProcessingException { rewriteAndEvaluate(atomicCommand, getEvaluator(Collections.emptyMap()), this.getContext(), this.getContext().getMetadata()); return RelationalNodeUtil.shouldExecute(atomicCommand, true); }
return true; if (transactionalReads || RelationalNodeUtil.isUpdate(command) || (command instanceof StoredProcedure && ((StoredProcedure)command).getUpdateCount() != 0)) { if ((multiSource && connectorBindingExpression == null)) { return true;