private Command rewriteUpdateProcedure(CreateProcedureCommand command) throws TeiidComponentException { Block block = rewriteBlock(command.getBlock()); command.setBlock(block); return command; }
private Command rewriteUpdateProcedure(CreateProcedureCommand command) throws TeiidComponentException { Block block = rewriteBlock(command.getBlock()); command.setBlock(block); return command; }
private Command rewriteUpdateProcedure(CreateProcedureCommand command) throws TeiidComponentException { Block block = rewriteBlock(command.getBlock()); command.setBlock(block); return command; }
final public CreateProcedureCommand createProcedure(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[53] = jj_gen; ; } jj_consume_token(PROCEDURE); stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
final public CreateProcedureCommand createProcedure(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[53] = jj_gen; ; } jj_consume_token(PROCEDURE); stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
final public CreateProcedureCommand createProcedure(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[54] = jj_gen; ; } jj_consume_token(PROCEDURE); stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
final public CreateProcedureCommand procedureBodyCommand(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; if (jj_2_12(2)) { jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[55] = jj_gen; ; } jj_consume_token(PROCEDURE); } else { ; } stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
final public CreateProcedureCommand procedureBodyCommand(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; if (jj_2_11(2)) { jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[54] = jj_gen; ; } jj_consume_token(PROCEDURE); } else { ; } stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
final public CreateProcedureCommand procedureBodyCommand(ParseInfo info) throws ParseException { CreateProcedureCommand procCmd = new CreateProcedureCommand(); Statement stmt = null; if (jj_2_11(2)) { jj_consume_token(CREATE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VIRTUAL: jj_consume_token(VIRTUAL); break; default: jj_la1[54] = jj_gen; ; } jj_consume_token(PROCEDURE); } else { ; } stmt = statement(info); procCmd.setBlock(asBlock(stmt)); {if (true) return procCmd;} throw new Error("Missing return statement in function"); }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CreateProcedureCommand copy = new CreateProcedureCommand(); //Clone this class state if (this.block != null) { copy.setBlock(this.block.clone()); } if (this.projectedSymbols != null) { copy.projectedSymbols = LanguageObject.Util.deepClone(this.projectedSymbols, Expression.class); } if (this.resultSetColumns != null) { copy.resultSetColumns = LanguageObject.Util.deepClone(this.resultSetColumns, Expression.class); } if (this.virtualGroup != null) { copy.virtualGroup = this.virtualGroup.clone(); } if (this.returnVariable != null) { copy.returnVariable = this.returnVariable; } copy.updateType = this.updateType; this.copyMetadataState(copy); return copy; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CreateProcedureCommand copy = new CreateProcedureCommand(); //Clone this class state if (this.block != null) { copy.setBlock(this.block.clone()); } if (this.projectedSymbols != null) { copy.projectedSymbols = LanguageObject.Util.deepClone(this.projectedSymbols, Expression.class); } if (this.resultSetColumns != null) { copy.resultSetColumns = LanguageObject.Util.deepClone(this.resultSetColumns, Expression.class); } if (this.virtualGroup != null) { copy.virtualGroup = this.virtualGroup.clone(); } if (this.returnVariable != null) { copy.returnVariable = this.returnVariable; } copy.updateType = this.updateType; this.copyMetadataState(copy); return copy; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { CreateProcedureCommand copy = new CreateProcedureCommand(); //Clone this class state if (this.block != null) { copy.setBlock(this.block.clone()); } if (this.projectedSymbols != null) { copy.projectedSymbols = LanguageObject.Util.deepClone(this.projectedSymbols, Expression.class); } if (this.resultSetColumns != null) { copy.resultSetColumns = LanguageObject.Util.deepClone(this.resultSetColumns, Expression.class); } if (this.virtualGroup != null) { copy.virtualGroup = this.virtualGroup.clone(); } if (this.returnVariable != null) { copy.returnVariable = this.returnVariable; } copy.updateType = this.updateType; this.copyMetadataState(copy); return copy; }
public void testSetBlock() { CreateProcedureCommand b1 = (CreateProcedureCommand)sample1().clone(); b1.setBlock(TestBlock.sample2()); assertTrue("Incorrect Block on command", b1.getBlock().equals(TestBlock.sample2())); //$NON-NLS-1$ }
private Command asLoopProcedure(GroupSymbol group, QueryCommand query, Statement s, GroupSymbol varGroup, int updateType) throws QueryResolverException, TeiidComponentException, TeiidProcessingException { Block b = new Block(); b.addStatement(s); CreateProcedureCommand cupc = new CreateProcedureCommand(); cupc.setUpdateType(updateType); Block parent = new Block(); parent.setAtomic(true); ElementSymbol rowsUpdated = new ElementSymbol(ProcedureReservedWords.VARIABLES+Symbol.SEPARATOR+"ROWS_UPDATED"); //$NON-NLS-1$ DeclareStatement ds = new DeclareStatement(rowsUpdated, DataTypeManager.DefaultDataTypes.INTEGER, new Constant(0)); parent.addStatement(ds); LoopStatement ls = new LoopStatement(b, query, varGroup.getName()); parent.addStatement(ls); AssignmentStatement as = new AssignmentStatement(); rowsUpdated.setType(DataTypeManager.DefaultDataClasses.INTEGER); as.setVariable(rowsUpdated); as.setExpression(new Function("+", new Expression[] {rowsUpdated, new Constant(1)})); //$NON-NLS-1$ b.addStatement(as); Query returnQuery = new Query(); returnQuery.setSelect(new Select(Arrays.asList(rowsUpdated.clone()))); parent.addStatement(new CommandStatement(returnQuery)); cupc.setBlock(parent); cupc.setVirtualGroup(group); QueryResolver.resolveCommand(cupc, metadata); return rewrite(cupc, metadata, context); }
returnQuery.setSelect(new Select(Arrays.asList(rowsUpdated.clone()))); parent.addStatement(new CommandStatement(returnQuery)); cupc.setBlock(parent); cupc.setVirtualGroup(group); QueryResolver.resolveCommand(cupc, metadata);
returnQuery.setSelect(new Select(Arrays.asList(rowsUpdated.clone()))); parent.addStatement(new CommandStatement(returnQuery)); cupc.setBlock(parent); cupc.setVirtualGroup(group); QueryResolver.resolveCommand(cupc, metadata);
virtualProcedureCommand.setBlock(block);