#1262 - ENH: Support firstRow maxRows with findNative()

This commit is contained in:
Rob Bygrave committed 2018-02-16 00:11:27 +13:00
1 parent 6c1b295d41
commit 9926cad7f1
3 files changed
+56 -26

No files matched your search

@@ -366,6 +366,10 @@ class CQueryBuilder {
return new SqlTreeBuilder(this, request, predicates).build();
}
private String nativeQueryPaging(SpiQuery<?> query, String sql) {
return dbPlatform.getBasicSqlLimiter().limit(sql, query.getFirstRow(), query.getMaxRows());
}
/**
* Create the SqlTree by reading the ResultSetMetaData and mapping table/columns to bean property paths.
*/
@@ -375,6 +379,9 @@ class CQueryBuilder {
// parse named parameters returning the final sql to execute
String sql = predicates.parseBindParams(query.getNativeSql());
if (query.hasMaxRowsOrFirstRow()) {
sql = nativeQueryPaging(query, sql);
}
query.setGeneratedSql(sql);
Connection connection = request.getTransaction().getConnection();