本文整理了Java中org.apache.metamodel.query.Query.setFirstRow
方法的一些代码示例,展示了Query.setFirstRow
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setFirstRow
方法的具体详情如下:
包路径:org.apache.metamodel.query.Query
类名称:Query
方法名:setFirstRow
[英]Sets the first row (aka offset) of the query's result. The row number is 1-based, so setting a first row value of 1 is equivalent to not setting it at all..
[中]设置查询结果的第一行(也称为偏移量)。行号是基于1的,因此将第一行值设置为1相当于根本不设置它。。
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public SatisfiedQueryBuilder<GroupedQueryBuilder> offset(int offset) {
if (offset >= 0) {
_query.setFirstRow(offset + 1);
} else {
_query.setFirstRow(null);
}
return this;
}
代码示例来源:origin: apache/metamodel
@Override
public SatisfiedQueryBuilder<GroupedQueryBuilder> offset(int offset) {
if (offset >= 0) {
_query.setFirstRow(offset + 1);
} else {
_query.setFirstRow(null);
}
return this;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public SatisfiedQueryBuilder<GroupedQueryBuilder> firstRow(int firstRow) {
if (firstRow >= 0) {
_query.setFirstRow(firstRow);
} else {
_query.setFirstRow(null);
}
return this;
}
代码示例来源:origin: apache/metamodel
@Override
public SatisfiedQueryBuilder<GroupedQueryBuilder> firstRow(int firstRow) {
if (firstRow >= 0) {
_query.setFirstRow(firstRow);
} else {
_query.setFirstRow(null);
}
return this;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
private void parseOffsetClause(Query query, String offsetClause) {
offsetClause = offsetClause.trim();
if (!offsetClause.isEmpty()) {
try {
final int offset = Integer.parseInt(offsetClause);
// ofset is 0-based, but first-row is 1-based
final int firstRow = offset + 1;
query.setFirstRow(firstRow);
} catch (NumberFormatException e) {
throw new QueryParserException("Could not parse OFFSET value: " + offsetClause);
}
}
}
代码示例来源:origin: apache/metamodel
private void parseOffsetClause(Query query, String offsetClause) {
offsetClause = offsetClause.trim();
if (!offsetClause.isEmpty()) {
try {
final int offset = Integer.parseInt(offsetClause);
// ofset is 0-based, but first-row is 1-based
final int firstRow = offset + 1;
query.setFirstRow(firstRow);
} catch (NumberFormatException e) {
throw new QueryParserException("Could not parse OFFSET value: " + offsetClause);
}
}
}
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
@Override
public Query optimizeQuery(Query q, Category category) {
if (category == Category.VALID) {
q.setMaxRows(maxRows);
if (firstRow > 1) {
q.setFirstRow(firstRow);
}
if (orderColumn != null) {
Column physicalColumn = orderColumn.getPhysicalColumn();
q.orderBy(physicalColumn);
}
} else {
throw new IllegalStateException("Can only optimize the VALID max rows category");
}
return q;
}
代码示例来源:origin: datacleaner/DataCleaner
q.setFirstRow(firstRow);
} else {
final int newFirstRow = previousFirstRow.intValue() + firstRow;
q.setFirstRow(newFirstRow);
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
final DataContext dataContext = con.getDataContext();
Query pagedQuery = dataContext.parseQuery(query);
pagedQuery.setFirstRow(firstRow);
pagedQuery.setMaxRows(maxRows);
try (final DataSet dataSet = dataContext.executeQuery(pagedQuery)) {
代码示例来源:origin: datacleaner/DataCleaner
private DCPanel createPagingButtonPanel() {
if (_query == null) {
return null;
}
final Integer maxRows = _query.getMaxRows();
if (maxRows == null) {
// no paging needed when there are no max rows property
return null;
}
_previousPageButton.addActionListener(e -> {
int newFirstRow = getFirstRow() - maxRows;
if (newFirstRow <= 0) {
newFirstRow = 1;
}
_query.setFirstRow(newFirstRow);
updateTable();
});
_nextPageButton.addActionListener(e -> {
final int newFirstRow = getFirstRow() + maxRows;
_query.setFirstRow(newFirstRow);
updateTable();
});
final DCPanel buttonPanel = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND);
buttonPanel.setBorder(new MatteBorder(1, 0, 0, 0, WidgetUtils.BG_COLOR_LESS_BRIGHT));
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 10));
buttonPanel.add(_previousPageButton);
buttonPanel.add(_nextPageButton);
return buttonPanel;
}
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
final Query countQuery = originalQuery.clone();
countQuery.setMaxRows(null);
countQuery.setFirstRow(null);
countQuery.getSelectClause().removeItems();
countQuery.getOrderByClause().removeItems();
代码示例来源:origin: datacleaner/DataCleaner
final Query countQuery = originalQuery.clone();
countQuery.setMaxRows(null);
countQuery.setFirstRow(null);
countQuery.getSelectClause().removeItems();
countQuery.getOrderByClause().removeItems();
代码示例来源:origin: apache/metamodel
innerQuery.setFirstRow(null);
innerQuery.setMaxRows(null);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
innerQuery.setFirstRow(null);
innerQuery.setMaxRows(null);
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public Query clone() {
final Query q = new Query();
q.setMaxRows(_maxRows);
q.setFirstRow(_firstRow);
q.getSelectClause().setDistinct(_selectClause.isDistinct());
for (FromItem item : _fromClause.getItems()) {
q.from(item.clone());
}
for (SelectItem item : _selectClause.getItems()) {
q.select(item.clone(q));
}
for (FilterItem item : _whereClause.getItems()) {
q.where(item.clone());
}
for (GroupByItem item : _groupByClause.getItems()) {
q.groupBy(item.clone());
}
for (FilterItem item : _havingClause.getItems()) {
q.having(item.clone());
}
for (OrderByItem item : _orderByClause.getItems()) {
q.orderBy(item.clone());
}
return q;
}
}
代码示例来源:origin: apache/metamodel
@Override
public Query clone() {
final Query q = new Query();
q.setMaxRows(_maxRows);
q.setFirstRow(_firstRow);
q.getSelectClause().setDistinct(_selectClause.isDistinct());
for (FromItem item : _fromClause.getItems()) {
q.from(item.clone());
}
for (SelectItem item : _selectClause.getItems()) {
q.select(item.clone(q));
}
for (FilterItem item : _whereClause.getItems()) {
q.where(item.clone());
}
for (GroupByItem item : _groupByClause.getItems()) {
q.groupBy(item.clone());
}
for (FilterItem item : _havingClause.getItems()) {
q.having(item.clone());
}
for (OrderByItem item : _orderByClause.getItems()) {
q.orderBy(item.clone());
}
return q;
}
}
内容来源于网络,如有侵权,请联系作者删除!