Java SQL ResultSet moveToPageNo(ResultSet rs, int pageNo, int pageSize)

Here you can find the source of moveToPageNo(ResultSet rs, int pageNo, int pageSize)

Description

The result set cursor move to current page number.

License

Apache License

Parameter

Parameter Description
rs The result set cursor move to page number.
pageNo The current page number.
pageSize The page size of one page.

Exception

Parameter Description
SQLException an exception

Declaration

public static void moveToPageNo(ResultSet rs, int pageNo, int pageSize) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    /**/* w w  w .  j a va2s.  co  m*/
     * The result set cursor move to current page number. 
     * 
     * @param rs The result set cursor move to page number.
     * @param pageNo The current page number. 
     * @param pageSize The page size of one page.
     * @throws SQLException
     */
    public static void moveToPageNo(ResultSet rs, int pageNo, int pageSize) throws SQLException {
        if (pageNo > 1) {
            int row = (pageNo - 1) * pageSize;
            rs.absolute(row);
        }
    }
}

Related

  1. isReturnsInvalidResultSetException(SQLException se)
  2. isSupportedResultSetType(Connection connection, int resultSetType)
  3. loadListMap(final ResultSet rs)
  4. logCurrentResultSetRow(Log log, String msg, ResultSet rs)
  5. mapResultSet(ResultSet set)
  6. parseSqlResultToListMap(ResultSet rs)
  7. putResultSetToMap(final Hashtable map, final ResultSet resultSet, final String... keys)
  8. safeGetString(ResultSet r, String name)
  9. saveResultsetAsFile(ResultSet rs, String filePath, String fileName)