Dialect dialect = getFactory().getDialect();
if ( !dialect.supportsVariableLimit() ) {
return 0;
}
if ( !hasMaxRows( selection ) ) {
throw new AssertionFailure( "no max results set" );
}
int firstRow = getFirstRow( selection );
int lastRow = getMaxOrLimit( selection, dialect );
boolean hasFirstRow = firstRow > 0 && dialect.supportsLimitOffset();
boolean reverse = dialect.bindLimitParametersInReverseOrder();