Java SQL ResultSet Read getRowCount(ResultSet set)

Here you can find the source of getRowCount(ResultSet set)

Description

get Row Count

License

Apache License

Declaration

public static int getRowCount(ResultSet set) throws SQLException 

Method Source Code

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

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

public class Main {
    public static int getRowCount(ResultSet set) throws SQLException {
        int rowCount;
        int currentRow = set.getRow(); // Get current row  
        rowCount = set.last() ? set.getRow() : 0; // Determine number of rows  
        if (currentRow == 0) // If there was no current row  
            set.beforeFirst(); // We want next() to go to first row  
        else // If there WAS a current row  
            set.absolute(currentRow); // Restore it  
        return rowCount;
    }//from   ww  w  .j a  v  a2s.  co  m
}

Related

  1. getResultSetValue(ResultSet rs, int index, Class requiredType)
  2. getResultSetValue(ResultSet rs, int index, Class requiredType)
  3. getReturnCountInt(ResultSet rs, int column)
  4. getRow(ResultSet rs)
  5. getRowCount(final ResultSet rs)
  6. getRows(final ResultSet rs)
  7. getRows(ResultSet table)
  8. getRsCloumns(ResultSet rs)
  9. getRSData(ResultSet rs, String columnName, int jdbcType)