org.teiid.query.sql.lang.Query.setLimit()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(398)

本文整理了Java中org.teiid.query.sql.lang.Query.setLimit方法的一些代码示例,展示了Query.setLimit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setLimit方法的具体详情如下:
包路径:org.teiid.query.sql.lang.Query
类名称:Query
方法名:setLimit

Query.setLimit介绍

暂无

代码示例

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithOffset() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Constant(new Integer(50)), new Constant(new Integer(100))));
  8. helpTest("Select * from a limit 50,100", "SELECT * FROM a LIMIT 50, 100", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: org.teiid/teiid-engine

  1. query.setOrderBy(null);
  2. Limit limit = query.getLimit();
  3. query.setLimit(null);
  4. Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
  5. for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
  6. ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
  7. outerQuery.setOrderBy(orderBy);
  8. outerQuery.setLimit(limit);
  9. ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
  10. outerQuery.setSelect(select);

代码示例来源:origin: teiid/teiid

  1. query.setOrderBy(null);
  2. Limit limit = query.getLimit();
  3. query.setLimit(null);
  4. Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
  5. for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
  6. ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
  7. outerQuery.setOrderBy(orderBy);
  8. outerQuery.setLimit(limit);
  9. ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
  10. outerQuery.setSelect(select);

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithOffsetKeyword() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Constant(new Integer(50)), new Constant(new Integer(100))));
  8. helpTest("Select * from a limit 100 offset 50", "SELECT * FROM a LIMIT 50, 100", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. query.setOrderBy(null);
  2. Limit limit = query.getLimit();
  3. query.setLimit(null);
  4. Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
  5. for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
  6. ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
  7. outerQuery.setOrderBy(orderBy);
  8. outerQuery.setLimit(limit);
  9. ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
  10. outerQuery.setSelect(select);

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithOffset() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Constant(new Integer(50)), new Constant(new Integer(100))));
  8. helpTest(query, "SELECT * FROM a LIMIT 50, 100"); //$NON-NLS-1$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimit() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(null, new Constant(new Integer(100))));
  8. helpTest(query, "SELECT * FROM a LIMIT 100"); //$NON-NLS-1$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimit() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(null, new Constant(new Integer(100))));
  8. helpTest("Select * from a limit 100", "SELECT * FROM a LIMIT 100", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithReferences2() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Constant(new Integer(50)), new Reference(0)));
  8. helpTest("Select * from a limit 50,?", "SELECT * FROM a LIMIT 50, ?", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithReferences1() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Reference(0), new Constant(new Integer(100))));
  8. helpTest("Select * from a limit ?,100", "SELECT * FROM a LIMIT ?, 100", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. query.setLimit(rewriteLimitClause(query.getLimit()));

代码示例来源:origin: teiid/teiid

  1. @Test public void testFetchFirst() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(null, new Constant(2)));
  8. helpTest("Select * from a fetch first 2 rows only", "SELECT * FROM a LIMIT 2", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testOffset() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Reference(0), null));
  8. helpTest("Select * from a offset ? rows", "SELECT * FROM a OFFSET ? ROWS", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testFetchFirstRow() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(null, new Constant(1)));
  8. helpTest("Select * from a fetch first row only", "SELECT * FROM a LIMIT 1", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. static void planQueries(final MappingSourceNode sourceNode, XMLPlannerEnvironment planEnv)
  2. throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
  3. ResultSetInfo rsInfo = sourceNode.getResultSetInfo();
  4. // Create sql: SELECT * FROM rsName
  5. Query rsQuery = (Query)rsInfo.getCommand();
  6. // add user order by to base query
  7. rsQuery.setOrderBy(rsInfo.getOrderBy());
  8. // add user criteria to base query from model
  9. Criteria crit = rsInfo.getCriteria();
  10. try {
  11. if(crit != null) {
  12. planQueryWithCriteria(sourceNode, planEnv);
  13. }
  14. } catch (QueryResolverException e) {
  15. throw new TeiidComponentException(QueryPlugin.Event.TEIID30294, e);
  16. }
  17. if (rsInfo.getUserRowLimit() != -1) {
  18. int limit = rsInfo.getUserRowLimit();
  19. if (rsInfo.exceptionOnRowlimit()) {
  20. limit++;
  21. }
  22. rsQuery.setLimit(new Limit(null, new Constant(limit)));
  23. }
  24. // this query is not eligible for staging; proceed normally.
  25. rsInfo.setCommand(rsQuery);
  26. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testOffsetFetch() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Constant(2), new Constant(5)));
  8. helpTest("Select * from a offset 2 rows fetch first 5 rows only", "SELECT * FROM a LIMIT 2, 5", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testLimitWithReferences3() {
  2. Query query = new Query();
  3. Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  4. From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  5. query.setSelect(select);
  6. query.setFrom(from);
  7. query.setLimit(new Limit(new Reference(0), new Reference(1)));
  8. helpTest("Select * from a limit ?,?", "SELECT * FROM a LIMIT ?, ?", query); //$NON-NLS-1$ //$NON-NLS-2$
  9. }

代码示例来源:origin: org.teiid/teiid-engine

  1. copy.setLimit( getLimit().clone());

代码示例来源:origin: teiid/teiid

  1. copy.setLimit( getLimit().clone());

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. copy.setLimit( getLimit().clone());

相关文章