/** * rewrite as loop on (query) as X begin newupdate; rows_updated = rows_updated + 1 end; * @param updateType */ private Command asLoopProcedure(GroupSymbol group, QueryCommand query, ProcedureContainer newUpdate, GroupSymbol varGroup, int updateType) throws QueryResolverException, TeiidComponentException, TeiidProcessingException { return asLoopProcedure(group, query, new CommandStatement(newUpdate), varGroup, updateType); }
private Mode getMode(CreateProcedureCommand parentProcCommand, CommandStatement cmdStmt, Command command) { if (!command.returnsResultSet()&&!(command instanceof StoredProcedure)) { return Mode.UPDATE; } if (parentProcCommand.returnsResultSet()&&cmdStmt.isReturnable()&&cmdStmt.getCommand().returnsResultSet()) { return Mode.HOLD; } return Mode.NOHOLD; }
CommandStatement cs = new CommandStatement(cmd); cs.setReturnable(returnable); {if (true) return cs;} throw new Error("Missing return statement in function");
/** * Get hashcode for CommandStatement. WARNING: This hash code relies on the * hash code of the command on this statement. * @return Hash code */ public int hashCode() { // This hash code relies on the commands hash code return this.getCommand().hashCode(); }
CommandStatement cs = new CommandStatement(cmd); cs.setReturnable(returnable); {if (true) return cs;} throw new Error("Missing return statement in function");
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(CommandStatement obj) { this.commands.add(obj.getCommand()); }
private Mode getMode(CreateProcedureCommand parentProcCommand, CommandStatement cmdStmt, Command command) { if (!command.returnsResultSet()&&!(command instanceof StoredProcedure)) { return Mode.UPDATE; } if (parentProcCommand.returnsResultSet()&&cmdStmt.isReturnable()&&cmdStmt.getCommand().returnsResultSet()) { return Mode.HOLD; } return Mode.NOHOLD; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CommandStatement cs = new CommandStatement((Command)this.command.clone()); cs.returnable = this.returnable; return cs; }
CommandStatement cs = new CommandStatement(cmd); cs.setReturnable(returnable); {if (true) return cs;} throw new Error("Missing return statement in function");
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(CommandStatement obj) { this.commands.add(obj.getCommand()); }
private Mode getMode(CreateProcedureCommand parentProcCommand, CommandStatement cmdStmt, Command command) { if (!command.returnsResultSet()&&!(command instanceof StoredProcedure)) { return Mode.UPDATE; } if (parentProcCommand.returnsResultSet()&&cmdStmt.isReturnable()&&cmdStmt.getCommand().returnsResultSet()) { return Mode.HOLD; } return Mode.NOHOLD; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CommandStatement cs = new CommandStatement((Command)this.command.clone()); cs.returnable = this.returnable; return cs; }
@Test public void testCommandStatement1a() { Query q1 = new Query(); Select select = new Select(); select.addSymbol(new ElementSymbol("x")); //$NON-NLS-1$ q1.setSelect(select); From from = new From(); from.addGroup(new GroupSymbol("g")); //$NON-NLS-1$ q1.setFrom(from); CommandStatement cmdStmt = new CommandStatement(q1); cmdStmt.setReturnable(false); helpTest(cmdStmt, "SELECT x FROM g WITHOUT RETURN;"); //$NON-NLS-1$ }
/** * Get hashcode for CommandStatement. WARNING: This hash code relies on the * hash code of the command on this statement. * @return Hash code */ public int hashCode() { // This hash code relies on the commands hash code return this.getCommand().hashCode(); }
public void visit(CommandStatement obj) { if (!obj.isReturnable() || obj.getCommand() instanceof DynamicCommand || !obj.getCommand().returnsResultSet()) { return; } for (int i = 0; i < proc.getResultSet().getColumns().size(); i++) { Column c = proc.getResultSet().getColumns().get(i); LinkedHashSet<AbstractMetadataRecord> columnValues = null; if (c.getIncomingObjects() instanceof LinkedHashSet) { columnValues = (LinkedHashSet<AbstractMetadataRecord>) c.getIncomingObjects(); } else { columnValues = new LinkedHashSet<>(); c.setIncomingObjects(columnValues); } determineDependencies(obj.getCommand(), c, i, columnValues); } } });
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CommandStatement cs = new CommandStatement((Command)this.command.clone()); cs.returnable = this.returnable; return cs; }
storedProcedure.setParameter(parameter); storedProcedure.setCalledWithReturn(true); CommandStatement cs = new CommandStatement(storedProcedure); cs.setReturnable(returnable); {if (true) return cs;} break;
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(CommandStatement obj) { this.commands.add(obj.getCommand()); }
public void visit(CommandStatement obj) { if (!obj.isReturnable() || obj.getCommand() instanceof DynamicCommand || !obj.getCommand().returnsResultSet()) { return; } for (int i = 0; i < proc.getResultSet().getColumns().size(); i++) { Column c = proc.getResultSet().getColumns().get(i); LinkedHashSet<AbstractMetadataRecord> columnValues = null; if (c.getIncomingObjects() instanceof LinkedHashSet) { columnValues = (LinkedHashSet<AbstractMetadataRecord>) c.getIncomingObjects(); } else { columnValues = new LinkedHashSet<>(); c.setIncomingObjects(columnValues); } determineDependencies(obj.getCommand(), c, i, columnValues); } } });
/** * rewrite as loop on (query) as X begin newupdate; rows_updated = rows_updated + 1 end; * @param updateType */ private Command asLoopProcedure(GroupSymbol group, QueryCommand query, ProcedureContainer newUpdate, GroupSymbol varGroup, int updateType) throws QueryResolverException, TeiidComponentException, TeiidProcessingException { return asLoopProcedure(group, query, new CommandStatement(newUpdate), varGroup, updateType); }