本文整理了Java中org.apache.metamodel.query.Query.getMaxRows
方法的一些代码示例,展示了Query.getMaxRows
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getMaxRows
方法的具体详情如下:
包路径:org.apache.metamodel.query.Query
类名称:Query
方法名:getMaxRows
暂无
代码示例来源:origin: datacleaner/DataCleaner
private void updatePagingButtons() {
if (_nextPageButton != null) {
if (_table.getRowCount() < _query.getMaxRows()) {
_nextPageButton.setEnabled(false);
} else {
_nextPageButton.setEnabled(true);
}
}
if (_previousPageButton != null) {
if (getFirstRow() <= 1) {
_previousPageButton.setEnabled(false);
} else {
_previousPageButton.setEnabled(true);
}
}
}
代码示例来源:origin: apache/metamodel
@Override
protected String rewriteSelectClause(Query query, SelectClause selectClause) {
String result = super.rewriteSelectClause(query, selectClause);
Integer maxRows = query.getMaxRows();
if (maxRows != null) {
if (query.getSelectClause().isDistinct()) {
result = "SELECT DISTINCT TOP " + maxRows + " " + result.substring("SELECT DISTINCT ".length());
} else {
result = "SELECT TOP " + maxRows + " " + result.substring("SELECT ".length());
}
}
return result;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
@Override
protected String rewriteSelectClause(Query query, SelectClause selectClause) {
String result = super.rewriteSelectClause(query, selectClause);
Integer maxRows = query.getMaxRows();
if (maxRows != null) {
if (query.getSelectClause().isDistinct()) {
result = "SELECT DISTINCT TOP " + maxRows + " " + result.substring("SELECT DISTINCT ".length());
} else {
result = "SELECT TOP " + maxRows + " " + result.substring("SELECT ".length());
}
}
return result;
}
代码示例来源: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: org.apache.metamodel/MetaModel-jdbc
/**
* Gets the fetch size of a query
*
* @param query
* the query to execute
* @return an integer representing how many rows to eagerly fetch for the
* query
*/
public int getFetchSize(Query query) {
if (isSingleRowQuery(query)) {
return 1;
}
int bytesPerRow = getRowSize(query);
int result = getFetchSize(bytesPerRow);
final Integer maxRows = query.getMaxRows();
if (maxRows != null && result > maxRows) {
logger.debug("Result ({}) was below max rows ({}), adjusting.",
result, maxRows);
result = maxRows;
}
return result;
}
代码示例来源:origin: apache/metamodel
/**
* Gets the fetch size of a query
*
* @param query
* the query to execute
* @return an integer representing how many rows to eagerly fetch for the
* query
*/
public int getFetchSize(Query query) {
if (isSingleRowQuery(query)) {
return 1;
}
int bytesPerRow = getRowSize(query);
int result = getFetchSize(bytesPerRow);
final Integer maxRows = query.getMaxRows();
if (maxRows != null && result > maxRows) {
logger.debug("Result ({}) was below max rows ({}), adjusting.",
result, maxRows);
result = maxRows;
}
return result;
}
代码示例来源:origin: datacleaner/DataCleaner
@Override
public Query optimizeQuery(final Query q, final Category category) {
if (category == Category.VALID) {
final Integer previousMaxRows = q.getMaxRows();
final Integer previousFirstRow = q.getFirstRow();
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
String queryString = super.rewriteQuery(query);
if (isSupportedVersion(_databaseProductName, _databaseSupportedVersion) && (query.getMaxRows() != null
|| query.getFirstRow() != null)) {
final Integer maxRows = query.getMaxRows();
Integer firstRow = query.getFirstRow();
代码示例来源:origin: apache/metamodel
String queryString = super.rewriteQuery(query);
if (isSupportedVersion(_databaseProductName, _databaseSupportedVersion) && (query.getMaxRows() != null
|| query.getFirstRow() != null)) {
final Integer maxRows = query.getMaxRows();
Integer firstRow = query.getFirstRow();
代码示例来源: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.apache.metamodel/MetaModel-mongodb-mongo3
int maxRows = (query.getMaxRows() == null ? -1 : query.getMaxRows());
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
final Integer maxRows = originalQuery.getMaxRows();
if (maxRows != null) {
expectedRows = Math.min(expectedRows, maxRows.intValue());
代码示例来源:origin: datacleaner/DataCleaner
final Integer maxRows = originalQuery.getMaxRows();
if (maxRows != null) {
expectedRows = Math.min(expectedRows, maxRows.intValue());
代码示例来源:origin: apache/metamodel
@Override
public String rewriteQuery(Query query) {
final Integer firstRow = query.getFirstRow();
final Integer maxRows = 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: datacleaner/DataCleaner
logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core
logger.debug("Final query firstRow={}, maxRows={}", finalQuery.getFirstRow(), finalQuery.getMaxRows());
内容来源于网络,如有侵权,请联系作者删除!