private static boolean hasMaxRows(RowSelection selection) { return selection != null && selection.getMaxRows() != null; }
private static boolean hasMaxRows(RowSelection selection) { return selection != null && selection.getMaxRows() != null; }
/** * Some dialect-specific LIMIT clauses require the maximium last row number, * others require the maximum returned row count. */ private static int getMaxOrLimit(final RowSelection selection, final Dialect dialect) { final int firstRow = getFirstRow( selection ); final int lastRow = selection.getMaxRows().intValue(); if ( dialect.useMaxForLimit() ) { return lastRow + firstRow; } else { return lastRow; } }
/** * Use JDBC API to limit the number of rows returned by the SQL query if necessary */ private void setMaxRows( final PreparedStatement st, final RowSelection selection) throws SQLException { if ( hasMaxRows( selection ) ) { st.setMaxRows( selection.getMaxRows().intValue() + getFirstRow( selection ) ); } }
/** * Use JDBC API to limit the number of rows returned by the SQL query if necessary */ private void setMaxRows(final PreparedStatement st, final RowSelection selection) throws SQLException { if ( hasMaxRows( selection ) ) { st.setMaxRows( selection.getMaxRows().intValue() + getFirstRow( selection ) ); } }
selection.getMaxRows().intValue() : Integer.MAX_VALUE;
selection.getMaxRows().intValue() : Integer.MAX_VALUE;
? 0 : queryParameters.getRowSelection().getFirstRow().intValue(); int max = queryParameters.getRowSelection().getMaxRows() == null ? -1 : queryParameters.getRowSelection().getMaxRows().intValue(); final int size = tmp.size(); for ( int x = 0; x < size; x++ ) {
public QueryKey(String queryString, QueryParameters queryParameters, Set filters, EntityMode entityMode) { this.sqlQueryString = queryString; this.types = queryParameters.getPositionalParameterTypes(); this.values = queryParameters.getPositionalParameterValues(); RowSelection selection = queryParameters.getRowSelection(); if (selection!=null) { firstRow = selection.getFirstRow(); maxRows = selection.getMaxRows(); } else { firstRow = null; maxRows = null; } this.namedParameters = queryParameters.getNamedParameters(); this.entityMode = entityMode; this.filters = filters; this.hashCode = getHashCode(); }
? 0 : queryParameters.getRowSelection().getFirstRow().intValue(); int max = !hasLimit || queryParameters.getRowSelection().getMaxRows() == null ? -1 : queryParameters.getRowSelection().getMaxRows().intValue(); int size = results.size(); List tmp = new ArrayList();
public QueryKey(String queryString, QueryParameters queryParameters, Set filters, EntityMode entityMode) { this.sqlQueryString = queryString; this.types = queryParameters.getPositionalParameterTypes(); this.values = queryParameters.getPositionalParameterValues(); RowSelection selection = queryParameters.getRowSelection(); if (selection!=null) { firstRow = selection.getFirstRow(); maxRows = selection.getMaxRows(); } else { firstRow = null; maxRows = null; } this.namedParameters = queryParameters.getNamedParameters(); this.entityMode = entityMode; this.filters = filters; this.customTransformer = queryParameters.getResultTransformer(); this.hashCode = getHashCode(); }