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

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

本文整理了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

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

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

query.setOrderBy(null);
Limit limit = query.getLimit();
query.setLimit(null);
Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
outerQuery.setOrderBy(orderBy);
outerQuery.setLimit(limit);
ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
outerQuery.setSelect(select);

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

query.setOrderBy(null);
Limit limit = query.getLimit();
query.setLimit(null);
Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
outerQuery.setOrderBy(orderBy);
outerQuery.setLimit(limit);
ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
outerQuery.setSelect(select);

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

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

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

query.setOrderBy(null);
Limit limit = query.getLimit();
query.setLimit(null);
Set<Expression> newSelectColumns = new LinkedHashSet<Expression>();
for (final Iterator<Expression> iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
ExpressionMappingVisitor.mapExpressions(orderBy, expressionMap, true);
outerQuery.setOrderBy(orderBy);
outerQuery.setLimit(limit);
ExpressionMappingVisitor.mapExpressions(select, expressionMap, true);
outerQuery.setSelect(select);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static void planQueries(final MappingSourceNode sourceNode, XMLPlannerEnvironment planEnv) 
  throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
  ResultSetInfo rsInfo = sourceNode.getResultSetInfo();
  
  // Create sql:  SELECT * FROM rsName            
  Query rsQuery = (Query)rsInfo.getCommand();
  
  // add user order by to base query
  rsQuery.setOrderBy(rsInfo.getOrderBy());
  // add user criteria to base query from model
  Criteria crit = rsInfo.getCriteria();
  try {
    if(crit != null) {
      planQueryWithCriteria(sourceNode, planEnv);
    }
  } catch (QueryResolverException e) {
     throw new TeiidComponentException(QueryPlugin.Event.TEIID30294, e);
  }
  if (rsInfo.getUserRowLimit() != -1) {
    int limit = rsInfo.getUserRowLimit();
    if (rsInfo.exceptionOnRowlimit()) {
      limit++;
    }
    rsQuery.setLimit(new Limit(null, new Constant(limit)));
  }
  
  // this query is not eligible for staging; proceed normally.
  rsInfo.setCommand(rsQuery);            
}

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

@Test public void testOffsetFetch() {
  Query query = new Query();
  Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
  From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a")))); //$NON-NLS-1$
  query.setSelect(select);
  query.setFrom(from);
  query.setLimit(new Limit(new Constant(2), new Constant(5)));
  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$
}

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

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

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

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

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

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

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

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

相关文章