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 testInsertWithOption() { Insert insert = new Insert(); insert.setGroup(new GroupSymbol("m.g")); //$NON-NLS-1$ List<ElementSymbol> vars = new ArrayList<ElementSymbol>(); vars.add(new ElementSymbol("a")); //$NON-NLS-1$ insert.setVariables(vars); List<Reference> values = new ArrayList<Reference>(); values.add(new Reference(0)); insert.setValues(values); Option option = new Option(); option.setNoCache(true); insert.setOption(option); TestParser.helpTest("INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE", //$NON-NLS-1$ "INSERT INTO m.g (a) VALUES (?) OPTION NOCACHE", //$NON-NLS-1$ insert); }
case OPTION: option = option(info); insert.setOption(option); break; default:
case OPTION: option = option(info); insert.setOption(option); break; default:
case OPTION: option = option(info); insert.setOption(option); break; default: