/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
/** * Deep clone this object to produce a new identical query. * @return Deep clone */ public Object clone() { SetQuery copy = new SetQuery(this.operation); this.copyMetadataState(copy); copy.leftQuery = (QueryCommand)this.leftQuery.clone(); copy.rightQuery = (QueryCommand)this.rightQuery.clone(); copy.setAll(this.all); if(this.getOrderBy() != null) { copy.setOrderBy(this.getOrderBy().clone()); } if(this.getLimit() != null) { copy.setLimit( (Limit) this.getLimit().clone() ); } copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class)); if (this.projectedTypes != null) { copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata); } return copy; }
public static org.teiid.query.sql.lang.SetQuery helpExampleSetQuery() { org.teiid.query.sql.lang.SetQuery setQuery = new org.teiid.query.sql.lang.SetQuery(Operation.UNION); setQuery.setAll(false); setQuery.setLeftQuery(TestQueryImpl.helpExample(true)); setQuery.setRightQuery(TestQueryImpl.helpExample(true)); setQuery.setOrderBy(TestOrderByImpl.helpExample()); return setQuery; }
SetQuery unionCommand = new SetQuery(setOp); boolean unionAll = ((Boolean)setOpNode.getProperty(NodeConstants.Info.USE_ALL)).booleanValue(); unionCommand.setAll(unionAll); int count = 0; OrderBy orderBy = null;
SetQuery unionCommand = new SetQuery(setOp); boolean unionAll = ((Boolean)setOpNode.getProperty(NodeConstants.Info.USE_ALL)).booleanValue(); unionCommand.setAll(unionAll); int count = 0; OrderBy orderBy = null;
SetQuery unionCommand = new SetQuery(setOp); boolean unionAll = ((Boolean)setOpNode.getProperty(NodeConstants.Info.USE_ALL)).booleanValue(); unionCommand.setAll(unionAll); int count = 0; OrderBy orderBy = null;
@Test public void testMultipleValues(){ SetQuery setQuery = new SetQuery(Operation.UNION); setQuery.setAll(true); Select select = new Select(); select.addSymbol(new ElementSymbol("c1")); //$NON-NLS-1$ Query query = new Query(); query.setSelect(select); setQuery.setLeftQuery(query); select = new Select(); select.addSymbol(new ElementSymbol("c2")); //$NON-NLS-1$ query = new Query(); query.setSelect(select); setQuery.setRightQuery(query); TestParser.helpTest("values (c1), (c2)", //$NON-NLS-1$ "SELECT c1 UNION ALL SELECT c2", //$NON-NLS-1$ setQuery); }
private SetQuery exampleSetQuery(Operation op) { GroupSymbol g = new GroupSymbol("g"); //$NON-NLS-1$ From from = new From(); from.addGroup(g); Select select = new Select(); select.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$ Query query1 = new Query(); query1.setSelect(select); query1.setFrom(from); g = new GroupSymbol("h"); //$NON-NLS-1$ from = new From(); from.addGroup(g); select = new Select(); select.addSymbol(new ElementSymbol("b")); //$NON-NLS-1$ Query query2 = new Query(); query2.setSelect(select); query2.setFrom(from); SetQuery setQuery = new SetQuery(op); setQuery.setAll(false); setQuery.setLeftQuery(query1); setQuery.setRightQuery(query2); return setQuery; }
public void test2() { 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); Query q2 = new Query(); select = new Select(); select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$ q2.setSelect(select); from = new From(); from.addGroup(new GroupSymbol("h")); //$NON-NLS-1$ q2.setFrom(from); SetQuery sq = new SetQuery(Operation.INTERSECT); sq.setAll(false); sq.setLeftQuery(q1); sq.setRightQuery(q2); assertEquals("Query combiner string doesn't match expected: ", //$NON-NLS-1$ "SELECT x FROM g INTERSECT SELECT y FROM h", //$NON-NLS-1$ sq.toString()); }
setQuery.setAll(true); setQuery.setLeftQuery(query1); setQuery.setRightQuery(query2);
/** SELECT x FROM g INTERSECT SELECT y FROM h ORDER BY x */ public static final SetQuery sample2() { 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); Query q2 = new Query(); select = new Select(); select.addSymbol(new ElementSymbol("y")); //$NON-NLS-1$ q2.setSelect(select); from = new From(); from.addGroup(new GroupSymbol("h")); //$NON-NLS-1$ q2.setFrom(from); SetQuery sq = new SetQuery(Operation.INTERSECT); sq.setAll(false); sq.setLeftQuery(q1); sq.setRightQuery(q2); OrderBy orderBy = new OrderBy(); orderBy.addVariable(new ElementSymbol("x")); //$NON-NLS-1$ sq.setOrderBy(orderBy); return sq; }
((SetQuery)queryCommand).setAll(false); } else if (CapabilitiesUtil.supports(Capability.QUERY_SELECT_DISTINCT, RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata), metadata, capFinder)) { Query query = (Query)queryCommand;
((SetQuery)queryCommand).setAll(false); } else if (CapabilitiesUtil.supports(Capability.QUERY_SELECT_DISTINCT, RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata), metadata, capFinder)) { Query query = (Query)queryCommand;
((SetQuery)queryCommand).setAll(false); } else if (CapabilitiesUtil.supports(Capability.QUERY_SELECT_DISTINCT, RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata), metadata, capFinder)) { Query query = (Query)queryCommand;
setQuery.setAll(false); GroupSymbol g = new GroupSymbol("g1"); //$NON-NLS-1$ From from = new From();
setQuery.setAll(false); GroupSymbol g = new GroupSymbol("g1"); //$NON-NLS-1$ From from = new From();