org.apache.metamodel.query.Query.getFirstRow()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(143)

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

Query.getFirstRow介绍

[英]Gets the first row (aka offset) of the query's result, or null if none is specified. The row number is 1-based, so setting a first row value of 1 is equivalent to not setting it at all..
[中]获取查询结果的第一行(也称为偏移量),如果未指定,则为null。行号是基于1的,因此将第一行值设置为1相当于根本不设置它。。

代码示例

代码示例来源:origin: datacleaner/DataCleaner

private int getFirstRow() {
  return _query.getFirstRow() == null ? 1 : _query.getFirstRow();
}

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

@Override
protected String rewriteSelectClause(Query query, SelectClause selectClause) {
  String result = super.rewriteSelectClause(query, selectClause);
  Integer firstRow = query.getFirstRow();
  Integer maxRows = query.getMaxRows();
  if (maxRows != null || firstRow != null) {
    if (maxRows == null) {
      maxRows = Integer.MAX_VALUE;
    }
    if (firstRow == null || firstRow <= 0) {
      result = "SELECT TOP " + maxRows + " " + result.substring(7);
    } else {
      final int offset = firstRow - 1;
      result = "SELECT LIMIT " + offset + " " + maxRows + " " + result.substring(7);
    }
  }
  return result;
}

代码示例来源:origin: apache/metamodel

@Override
protected String rewriteSelectClause(Query query, SelectClause selectClause) {
  String result = super.rewriteSelectClause(query, selectClause);
  Integer firstRow = query.getFirstRow();
  Integer maxRows = query.getMaxRows();
  if (maxRows != null || firstRow != null) {
    if (maxRows == null) {
      maxRows = Integer.MAX_VALUE;
    }
    if (firstRow == null || firstRow <= 0) {
      result = "SELECT TOP " + maxRows + " " + result.substring(7);
    } else {
      final int offset = firstRow - 1;
      result = "SELECT LIMIT " + offset + " " + maxRows + " " + result.substring(7);
    }
  }
  return result;
}

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

/**
   * {@inheritDoc}
   * 
   * If the Max rows and/or First row property of the query is set, then we
   * will use the database's LIMIT and OFFSET functions.
   */
  @Override
  public String rewriteQuery(Query query) {
    String queryString = super.rewriteQuery(query);
    Integer maxRows = query.getMaxRows();
    Integer firstRow = query.getFirstRow();
    if (maxRows != null || firstRow != null) {
      if (maxRows == null) {
        maxRows = Integer.MAX_VALUE;
      }
      queryString = queryString + " LIMIT " + maxRows;

      if (firstRow != null && firstRow > 1) {
        // offset is 0-based
        int offset = firstRow - 1;
        queryString = queryString + " OFFSET " + offset;
      }
    }

    return queryString;
  }
}

代码示例来源:origin: apache/metamodel

/**
   * {@inheritDoc}
   * 
   * If the Max rows and/or First row property of the query is set, then we
   * will use the database's LIMIT and OFFSET functions.
   */
  @Override
  public String rewriteQuery(Query query) {
    String queryString = super.rewriteQuery(query);
    Integer maxRows = query.getMaxRows();
    Integer firstRow = query.getFirstRow();
    if (maxRows != null || firstRow != null) {
      if (maxRows == null) {
        maxRows = Integer.MAX_VALUE;
      }
      queryString = queryString + " LIMIT " + maxRows;

      if (firstRow != null && firstRow > 1) {
        // offset is 0-based
        int offset = firstRow - 1;
        queryString = queryString + " OFFSET " + offset;
      }
    }

    return queryString;
  }
}

代码示例来源:origin: datacleaner/DataCleaner

if (category == Category.VALID) {
  final Integer previousMaxRows = q.getMaxRows();
  final Integer previousFirstRow = q.getFirstRow();
    int newMaxRows = Math.min(previousMaxRows.intValue(), maxRows);
    if (previousFirstRow != null) {
      final Integer newFirstRow = q.getFirstRow();
      final int maxWindowSizeFrombefore =
          previousFirstRow.intValue() + previousMaxRows.intValue() - newFirstRow;

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

|| query.getFirstRow() != null)) {
final Integer maxRows = query.getMaxRows();
Integer firstRow = query.getFirstRow();

代码示例来源:origin: apache/metamodel

|| query.getFirstRow() != null)) {
final Integer maxRows = query.getMaxRows();
Integer firstRow = query.getFirstRow();

代码示例来源:origin: org.apache.metamodel/MetaModel-salesforce

final Integer firstRow = query.getFirstRow();
final Integer maxRows = query.getMaxRows();
if (maxRows != null && maxRows > 0) {

代码示例来源:origin: apache/metamodel

final Integer firstRow = query.getFirstRow();
final Integer maxRows = query.getMaxRows();
if (maxRows != null && maxRows > 0) {

代码示例来源:origin: org.apache.metamodel/MetaModel-mongodb-mongo3

int firstRow = (query.getFirstRow() == null ? 1 : query.getFirstRow());
int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());

代码示例来源:origin: org.apache.metamodel/MetaModel-mongodb-mongo2

int firstRow = (query.getFirstRow() == null ? 1 : query.getFirstRow());
int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());
boolean thereIsAtLeastOneAlias = false;

代码示例来源:origin: apache/metamodel

int firstRow = (query.getFirstRow() == null ? 1 : query.getFirstRow());
int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());

代码示例来源:origin: apache/metamodel

int firstRow = (query.getFirstRow() == null ? 1 : query.getFirstRow());
int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());
boolean thereIsAtLeastOneAlias = false;

代码示例来源:origin: datacleaner/DataCleaner

if (finalQuery.getFirstRow() == null) {
  idGenerator = new SimpleRowIdGenerator();
} else {
  idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
    logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());

代码示例来源:origin: datacleaner/DataCleaner

@Override
public final ConsumeRowHandler createConsumeRowHandler() {
  final RowProcessingQueryOptimizer queryOptimizer = getQueryOptimizer();
  final Query finalQuery = queryOptimizer.getOptimizedQuery();
  final RowIdGenerator idGenerator;
  if (finalQuery.getFirstRow() == null) {
    idGenerator = new SimpleRowIdGenerator();
  } else {
    idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
  }
  final RowProcessingPublishers publishers = getPublishers();
  final AnalysisListener analysisListener = publishers.getAnalysisListener();
  for (final RowProcessingConsumer consumer : getConsumers()) {
    final ComponentJob componentJob = consumer.getComponentJob();
    final ComponentMetrics metrics =
        new AnalysisJobMetricsImpl(consumer.getAnalysisJob(), publishers).getComponentMetrics(componentJob);
    analysisListener.componentBegin(getStream().getAnalysisJob(), componentJob, metrics);
    if (consumer instanceof TransformerConsumer) {
      ((TransformerConsumer) consumer).setRowIdGenerator(idGenerator);
    }
  }
  final List<RowProcessingConsumer> consumers = queryOptimizer.getOptimizedConsumers();
  final Collection<? extends FilterOutcome> availableOutcomes = queryOptimizer.getOptimizedAvailableOutcomes();
  return new ConsumeRowHandler(consumers, availableOutcomes);
}

代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core

if (finalQuery.getFirstRow() == null) {
  idGenerator = new SimpleRowIdGenerator();
} else {
  idGenerator = new SimpleRowIdGenerator(finalQuery.getFirstRow());
    logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());

代码示例来源:origin: org.apache.metamodel/MetaModel-core

final List<OrderByItem> orderByItems = query.getOrderByClause().getItems();
final int firstRow = (query.getFirstRow() == null ? 1 : query.getFirstRow());
final int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

@Override
public String rewriteQuery(Query query) {
  final Integer firstRow = query.getFirstRow();
  final Integer maxRows = query.getMaxRows();

代码示例来源:origin: apache/metamodel

@Override
public String rewriteQuery(Query query) {
  final Integer firstRow = query.getFirstRow();
  final Integer maxRows = query.getMaxRows();

相关文章