Re: MySQL ResultSet - count rows?
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Mon, 10 Dec 2007 20:41:08 -0500
Arne Vajhøj wrote:
Dyreatnews@xxxxxxx wrote:On the other hand; if you're using a scrollable result set, you can loop
over it to find the size,
You don't even need to loop.
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT * FROM T1");
rs.last();
int n = rs.getRow();
rs.first();
But I would never use that construct.
Arne: What are the dangers of that construct?
I'm guessing that it's the overhead of going first / last / first on large datasets.
--
Lew
.
- Follow-Ups:
- Re: MySQL ResultSet - count rows?
- From: Arne Vajhøj
- Re: MySQL ResultSet - count rows?
- References:
- MySQL ResultSet - count rows?
- From: Christoph
- Re: MySQL ResultSet - count rows?
- From: Sabine Dinis Blochberger
- Re: MySQL ResultSet - count rows?
- From: Christoph
- Re: MySQL ResultSet - count rows?
- From: Dyreatnews
- Re: MySQL ResultSet - count rows?
- From: Arne Vajhøj
- MySQL ResultSet - count rows?
- Prev by Date: Re: MySQL ResultSet - count rows?
- Next by Date: What does everyone else do for graphically displaying data?
- Previous by thread: Re: MySQL ResultSet - count rows?
- Next by thread: Re: MySQL ResultSet - count rows?
- Index(es):
Relevant Pages
|