Here you can find the source of getRowCount(final ResultSet rs)
Parameter | Description |
---|---|
rs | ResultSet |
Parameter | Description |
---|---|
SQLException | on SQL problems |
public static int getRowCount(final ResultSet rs) throws SQLException
//package com.java2s; /* JAPI - (Yet another (hopefully) useful) Java API * * Copyright (C) 2004-2006 Christian Hujer * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA./*from w w w . j a v a 2 s. c o m*/ */ import java.sql.ResultSet; import java.sql.SQLException; public class Main { /** Get a ResultSet's size. * Warning: The ResultSet's Cursor is moved by invoking this method! * @param rs ResultSet * @return the number of rows in this ResultSet * @throws SQLException on SQL problems */ public static int getRowCount(final ResultSet rs) throws SQLException { return rs.last() ? rs.getRow() : 0; } }