/** * 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; }
/** * 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; }
/** * 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; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.loopBlock.clone(); Command otherQuery = (Command) this.query.clone(); LoopStatement ls = new LoopStatement(otherBlock, otherQuery, this.cursorName); ls.setLabel(label); return ls; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.loopBlock.clone(); Command otherQuery = (Command) this.query.clone(); LoopStatement ls = new LoopStatement(otherBlock, otherQuery, this.cursorName); ls.setLabel(label); return ls; }
/** * Deep clone statement to produce a new identical statement. * @return Deep clone */ public Object clone() { Block otherBlock = this.loopBlock.clone(); Command otherQuery = (Command) this.query.clone(); LoopStatement ls = new LoopStatement(otherBlock, otherQuery, this.cursorName); ls.setLabel(label); return ls; }
/** * Get deep clone of object * @return Deep copy of the object */ public FromClause cloneDirect() { Command commandCopy = null; if(this.command != null) { commandCopy = (Command) this.command.clone(); } SubqueryFromClause clause = new SubqueryFromClause(this.symbol.clone(), commandCopy); clause.setLateral(this.isLateral()); return clause; }
/** * Get deep clone of object * @return Deep copy of the object */ public FromClause cloneDirect() { Command commandCopy = null; if(this.command != null) { commandCopy = (Command) this.command.clone(); } SubqueryFromClause clause = new SubqueryFromClause(this.symbol.clone(), commandCopy); clause.setLateral(this.isLateral()); return clause; }
/** * Get deep clone of object * @return Deep copy of the object */ public FromClause cloneDirect() { Command commandCopy = null; if(this.command != null) { commandCopy = (Command) this.command.clone(); } SubqueryFromClause clause = new SubqueryFromClause(this.symbol.clone(), commandCopy); clause.setLateral(this.isLateral()); return clause; }
public void cloneOnTo(Alter<T> clone) { copyMetadataState(clone); if (this.definition != null) { clone.setDefinition((T)this.definition.clone()); } clone.setTarget(getTarget().clone()); }
public void cloneOnTo(Alter<T> clone) { copyMetadataState(clone); if (this.definition != null) { clone.setDefinition((T)this.definition.clone()); } clone.setTarget(getTarget().clone()); }
public void cloneOnTo(Alter<T> clone) { copyMetadataState(clone); if (this.definition != null) { clone.setDefinition((T)this.definition.clone()); } clone.setTarget(getTarget().clone()); }
@Test public void testPreserve() throws QueryParserException { String sql = "Select a From /*+ preserve */ db.g1 JOIN db.g2 ON a = b"; //$NON-NLS-1$ assertEquals("SELECT a FROM /*+ PRESERVE */ db.g1 INNER JOIN db.g2 ON a = b", QueryParser.getQueryParser().parseCommand(sql, new ParseInfo()).clone().toString()); //$NON-NLS-1$ }
@Test public void testTextTableAliasWithPeriod() throws Exception { Command command = helpResolve("select \"x.y.z\".*, \"x.y.z\".x from pm1.g1, texttable(e1 COLUMNS x string) \"x.y.z\""); //$NON-NLS-1$ assertEquals(2, command.getProjectedSymbols().size()); assertEquals("SELECT \"x.y.z\".*, \"x.y.z\".x FROM pm1.g1, TEXTTABLE(e1 COLUMNS x string) AS \"x.y.z\"", command.toString()); assertEquals("SELECT \"x.y.z\".*, \"x.y.z\".x FROM pm1.g1, TEXTTABLE(e1 COLUMNS x string) AS \"x.y.z\"", command.clone().toString()); }
@Test public void testTextTableSelector() throws Exception { String sql = "select x.* from (select * from pm1.g1) y, texttable(e1 || '\n' || e2 || '\n' || e3 SELECTOR 'c' COLUMNS x string) x"; Command c = QueryParser.getQueryParser().parseCommand(sql); assertEquals("SELECT x.* FROM (SELECT * FROM pm1.g1) AS y, TEXTTABLE(((((e1 || '\\u000A') || e2) || '\\u000A') || e3) SELECTOR 'c' COLUMNS x string) AS x", c.toString()); assertEquals("SELECT x.* FROM (SELECT * FROM pm1.g1) AS y, TEXTTABLE(((((e1 || '\\u000A') || e2) || '\\u000A') || e3) SELECTOR 'c' COLUMNS x string) AS x", c.clone().toString()); List<?>[] expected = new List<?>[] { Arrays.asList("c"), }; process(sql, expected); }
@Test public void testClone() throws Exception { String sql = "select * from objecttable(language 'x' 'teiid_context' COLUMNS y string 'teiid_row.userName') as X"; //$NON-NLS-1$ Command c = QueryParser.getQueryParser().parseCommand(sql); assertEquals("SELECT * FROM OBJECTTABLE(LANGUAGE 'x' 'teiid_context' COLUMNS y string 'teiid_row.userName') AS X", c.toString()); assertEquals("SELECT * FROM OBJECTTABLE(LANGUAGE 'x' 'teiid_context' COLUMNS y string 'teiid_row.userName') AS X", c.clone().toString()); }
static void helpTest(String sql, String expectedString, Command expectedCommand, ParseInfo info) { Command actualCommand = null; String actualString = null; try { actualCommand = QueryParser.getQueryParser().parseCommand(sql, info); actualString = actualCommand.toString(); } catch(Throwable e) { throw new RuntimeException(e); } assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$ assertEquals("Command objects do not match: ", expectedCommand, actualCommand); //$NON-NLS-1$ assertEquals("Cloned command objects do not match: ", expectedCommand, actualCommand.clone()); //$NON-NLS-1$ }
@Test public void testTextTableSelector1() throws Exception { String sql = "select x.* from texttable('cc,bb' SELECTOR 'c' COLUMNS x string) x"; Command c = QueryParser.getQueryParser().parseCommand(sql); assertEquals("SELECT x.* FROM TEXTTABLE('cc,bb' SELECTOR 'c' COLUMNS x string) AS x", c.toString()); assertEquals("SELECT x.* FROM TEXTTABLE('cc,bb' SELECTOR 'c' COLUMNS x string) AS x", c.clone().toString()); List<?>[] expected = new List<?>[] { }; process(sql, expected); }
private Command helpTest(String sql, String expected, QueryMetadataInterface metadata, AliasGenerator visitor) throws TeiidComponentException, TeiidProcessingException { Command command = TestResolver.helpResolve(sql, metadata); command = QueryRewriter.rewrite(command, metadata, null); command = (Command) command.clone(); command.acceptVisitor(visitor); assertEquals(expected, command.toString()); return command; }
static void helpTest(String sql, String expectedString, Command expectedCommand, ParseInfo info, String vdbName, String vdbVersion, String schemaName) throws QueryParserException { Command actualCommand = QueryParser.getQueryParser().parseCommand(sql, info, false, vdbName, vdbVersion, schemaName, null); String actualString = actualCommand.toString(); assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$ assertEquals("Command objects do not match: ", expectedCommand, actualCommand); //$NON-NLS-1$ assertEquals("Cloned command objects do not match: ", expectedCommand, actualCommand.clone()); //$NON-NLS-1$ } public static void helpTestExpression(String sql, String expectedString, Expression expected) throws QueryParserException {