public void setQueryExpression( QueryCommand query ) { if (query instanceof Query) { Query expr = (Query)query; //a single row constructor query is the same as values if (expr.isRowConstructor()) { this.values.clear(); this.queryExpression = null; for (Expression ex : expr.getSelect().getSymbols()) { addValue(SymbolMap.getExpression(ex)); } if (expr.getOption() != null && this.getOption() == null) { //this isn't ideal, parsing associates the option with values this.setOption(expr.getOption()); } return; } } this.queryExpression = query; }
public void setQueryExpression( QueryCommand query ) { if (query instanceof Query) { Query expr = (Query)query; //a single row constructor query is the same as values if (expr.isRowConstructor()) { this.values.clear(); this.queryExpression = null; for (Expression ex : expr.getSelect().getSymbols()) { addValue(SymbolMap.getExpression(ex)); } if (expr.getOption() != null && this.getOption() == null) { //this isn't ideal, parsing associates the option with values this.setOption(expr.getOption()); } return; } } this.queryExpression = query; }
public void setQueryExpression( QueryCommand query ) { if (query instanceof Query) { Query expr = (Query)query; //a single row constructor query is the same as values if (expr.isRowConstructor()) { this.values.clear(); this.queryExpression = null; for (Expression ex : expr.getSelect().getSymbols()) { addValue(SymbolMap.getExpression(ex)); } if (expr.getOption() != null && this.getOption() == null) { //this isn't ideal, parsing associates the option with values this.setOption(expr.getOption()); } return; } } this.queryExpression = query; }
@Test public void testElementInDoubleQuotes_Insert() throws Exception { GroupSymbol g = new GroupSymbol("x"); //$NON-NLS-1$ From from = new From(); from.addGroup(g); ElementSymbol e = new ElementSymbol("foo"); //$NON-NLS-1$ Insert query = new Insert(g, new ArrayList<ElementSymbol>(), new ArrayList()); query.addVariable(e); query.addValue(new Constant("bar", String.class)); //$NON-NLS-1$ helpTest("insert into x (\"foo\") values ('bar')", //$NON-NLS-1$ "INSERT INTO x (foo) VALUES ('bar')", //$NON-NLS-1$ query); }
@Test public void testInsertWithoutColumns() { Insert insert = new Insert(); insert.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$ insert.addValue(new Constant("a")); //$NON-NLS-1$ insert.addValue(new Constant("b")); //$NON-NLS-1$ helpTest("INSERT INTO m.g VALUES ('a', 'b')", //$NON-NLS-1$ "INSERT INTO m.g VALUES ('a', 'b')", //$NON-NLS-1$ insert); }
insert.addVariable(col); insert.addValue(new Constant(procEnv.getCurrentVariableContext().getValue(ProcedurePlan.ROWCOUNT))); QueryResolver.resolveCommand(insert, metadata.getDesignTimeMetadata()); TupleSource ts = procEnv.getDataManager().registerRequest(procEnv.getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter());
insert.addVariable(col); insert.addValue(new Constant(procEnv.getCurrentVariableContext().getValue(ProcedurePlan.ROWCOUNT))); QueryResolver.resolveCommand(insert, metadata.getDesignTimeMetadata()); TupleSource ts = procEnv.getDataManager().registerRequest(procEnv.getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter());
insert.addVariable(col); insert.addValue(new Constant(procEnv.getCurrentVariableContext().getValue(ProcedurePlan.ROWCOUNT))); QueryResolver.resolveCommand(insert, metadata.getDesignTimeMetadata()); TupleSource ts = procEnv.getDataManager().registerRequest(procEnv.getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter());