X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4DAF15290D for ; Wed, 6 Jul 2005 19:33:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97278-05 for ; Wed, 6 Jul 2005 22:33:35 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id EDF455285C for ; Wed, 6 Jul 2005 19:33:34 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DqISX-0001Xd-FH; Thu, 07 Jul 2005 10:33:37 +1200 Message-ID: <42CC5C41.90306@opencloud.com> Date: Thu, 07 Jul 2005 10:33:37 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Maik Wiege Cc: pgsql-jdbc@postgresql.org Subject: Re: get row count from a "cursor resultset" References: <42CC2EB6.8020505@gmx.de> <42CC5ACE.5070200@opencloud.com> In-Reply-To: <42CC5ACE.5070200@opencloud.com> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/34 X-Sequence-Number: 13182 Oliver Jowett wrote: > Maik Wiege wrote: > >>I didn't find a solution for this, but there must be, because the pgAdmin III - tool does this. After starting the query in the SQL-Dialog it asks wether to retrieve just the first 100 results or all results displaying the corect amount of found rows. Or is this just not possible with jdbc. > > > I'd point out that this does not require knowing exactly how many rows > there are -- only that there are more than 100. You can do the > equivalent in JDBC easily by setting fetchsize to 100 or so and calling > next() 100 times.. if you haven't hit the end of the resultset by that > point, it has more than 100 rows. Oh, sorry, my mistake -- I misread your description. Perhaps they are using either COUNT(*) in the same query or MOVE to get the number of rows. -O