/** * Should we pre-process the SQL string, adding a dialect-specific * LIMIT clause. */ private static boolean useLimit(final RowSelection selection, final Dialect dialect) { return dialect.supportsLimit() && hasMaxRows( selection ); }
/** * Should we pre-process the SQL string, adding a dialect-specific * LIMIT clause. */ private static boolean useLimit(final RowSelection selection, final Dialect dialect) { return dialect.supportsLimit() && hasMaxRows( selection ); }
/** * Should we pre-process the SQL string, adding a dialect-specific * LIMIT clause. */ private static boolean useLimit(final RowSelection selection, final Dialect dialect) { return dialect.supportsLimit() && hasMaxRows( selection ); }
/** * Should we pre-process the SQL string, adding a dialect-specific * LIMIT clause. */ private static boolean useLimit(final RowSelection selection, final Dialect dialect) { return dialect.supportsLimit() && hasMaxRows( 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 ) ); } }
/** * 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() + interpretFirstRow( 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() + interpretFirstRow( getFirstRow( selection ) ) ); } }
/** * Bind parameters needed by the dialect-specific LIMIT clause */ private int bindLimitParameters(final PreparedStatement st, final int index, final RowSelection selection) throws SQLException { 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(); if ( hasFirstRow ) st.setInt( index + ( reverse ? 1 : 0 ), firstRow ); st.setInt( index + ( reverse || !hasFirstRow ? 0 : 1 ), lastRow ); return hasFirstRow ? 2 : 1; }
final int maxRows = hasMaxRows( selection ) ? selection.getMaxRows().intValue() : Integer.MAX_VALUE;
final int maxRows = hasMaxRows( selection ) ? selection.getMaxRows().intValue() : Integer.MAX_VALUE;
/** * Bind parameter values needed by the dialect-specific LIMIT clause. * * @param statement The statement to which to bind limit param values. * @param index The bind position from which to start binding * @param selection The selection object containing the limit information. * @return The number of parameter values bound. * @throws java.sql.SQLException Indicates problems binding parameter values. */ private int bindLimitParameters( final PreparedStatement statement, final int index, final RowSelection selection) throws SQLException { 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(); if ( hasFirstRow ) { statement.setInt( index + ( reverse ? 1 : 0 ), firstRow ); } statement.setInt( index + ( reverse || !hasFirstRow ? 0 : 1 ), lastRow ); return hasFirstRow ? 2 : 1; }
/** * Bind parameter values needed by the dialect-specific LIMIT clause. * * @param statement The statement to which to bind limit param values. * @param index The bind position from which to start binding * @param selection The selection object containing the limit information. * @return The number of parameter values bound. * @throws java.sql.SQLException Indicates problems binding parameter values. */ private int bindLimitParameters( final PreparedStatement statement, final int index, final RowSelection selection) throws SQLException { Dialect dialect = getFactory().getDialect(); if ( !dialect.supportsVariableLimit() ) { return 0; } if ( !hasMaxRows( selection ) ) { throw new AssertionFailure( "no max results set" ); } int firstRow = interpretFirstRow( getFirstRow( selection ) ); int lastRow = getMaxOrLimit( selection, dialect ); boolean hasFirstRow = dialect.supportsLimitOffset() && ( firstRow > 0 || dialect.forceLimitUsage() ); boolean reverse = dialect.bindLimitParametersInReverseOrder(); if ( hasFirstRow ) { statement.setInt( index + ( reverse ? 1 : 0 ), firstRow ); } statement.setInt( index + ( reverse || !hasFirstRow ? 0 : 1 ), lastRow ); return hasFirstRow ? 2 : 1; }
/** * Bind parameter values needed by the dialect-specific LIMIT clause. * * @param statement The statement to which to bind limit param values. * @param index The bind position from which to start binding * @param selection The selection object containing the limit information. * @return The number of parameter values bound. * @throws java.sql.SQLException Indicates problems binding parameter values. */ private int bindLimitParameters( final PreparedStatement statement, final int index, final RowSelection selection) throws SQLException { Dialect dialect = getFactory().getDialect(); if ( !dialect.supportsVariableLimit() ) { return 0; } if ( !hasMaxRows( selection ) ) { throw new AssertionFailure( "no max results set" ); } int firstRow = interpretFirstRow( getFirstRow( selection ) ); int lastRow = getMaxOrLimit( selection, dialect ); boolean hasFirstRow = dialect.supportsLimitOffset() && ( firstRow > 0 || dialect.forceLimitUsage() ); boolean reverse = dialect.bindLimitParametersInReverseOrder(); if ( hasFirstRow ) { statement.setInt( index + ( reverse ? 1 : 0 ), firstRow ); } statement.setInt( index + ( reverse || !hasFirstRow ? 0 : 1 ), lastRow ); return hasFirstRow ? 2 : 1; }
final int maxRows = hasMaxRows( selection ) ? selection.getMaxRows() : Integer.MAX_VALUE;
final int maxRows = hasMaxRows( selection ) ? selection.getMaxRows() : Integer.MAX_VALUE;