pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
getMoreResults() issue
2+ messages / 2 participants
[nested] [flat]

* getMoreResults() issue
@ 2005-07-25 07:40 Les Carter <carterl@newkinetics.com>
  2005-07-25 23:15 ` Re: getMoreResults() issue Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Les Carter @ 2005-07-25 07:40 UTC (permalink / raw)
  To: pgsql-jdbc

This is a multi-part message in MIME format.

--bound1122277206
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Has anyone else managed to get Statement.getMoreResults() working with the JDBC3 drivers and Postgres 8?  It's always coming back as false for me even though I know there's more data.<br />Has anyone got a working example?<br />Does this method only work for PreparedStatements or does a regular Statement also bring back large numbers of rows from the DB in pages?<br /><br />Cheers,<br /><br />L<br />

--bound1122277206--




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: getMoreResults() issue
  2005-07-25 07:40 getMoreResults() issue Les Carter <carterl@newkinetics.com>
@ 2005-07-25 23:15 ` Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Jowett @ 2005-07-25 23:15 UTC (permalink / raw)
  To: Les Carter <carterl@newkinetics.com>; +Cc: pgsql-jdbc

Les Carter wrote:
> This is a multi-part message in MIME format. --bound1122277206
> Content-Type: text/html; charset=o-8859-1 Content-Transfer-Encoding:
> quoted-printable

Your mail client seems to be a bit confused there; I don't see any MIME
headers in the mail header itself.

> Has anyone else managed to get
> Statement.getMoreResults() working with the JDBC3 drivers and Postgres
> 8?  It's always coming back as false for me even though I know there's
> more data.

getMoreResults() returns false if either there are no more results, or
the next result is an update count. You must also check getUpdateCount()
to work out if you've run out of results or not. See the javadoc for
details.

As far as I know, getMoreResults() in the current driver works just fine.

> Has anyone got a working example?

I posted an example to the list recently -- check the archives
(archives.postgresql.org).

> Does this method only work for PreparedStatements or does a regular
> Statement also bring back large numbers of rows from the DB in pages?

getMoreResults() has nothing to do with "paging" large result sets, it's
to do with retriving multiple resultsets from a query that has many
statements -- e.g. "SELECT * FROM foo; SELECT * FROM bar; INSERT INTO
baz(1,2,3)" will return two resultsets and an update count.

If you want to retrieve a large resultset incrementally:

 - use a TYPE_FORWARD_ONLY resultset
 - ensure autocommit is off
 - set a non-zero fetchsize

and the driver will do the rest transparently, fetching data in blocks
behind the scenes.

-O



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-07-25 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 07:40 getMoreResults() issue Les Carter <carterl@newkinetics.com>
2005-07-25 23:15 ` Oliver Jowett <oliver@opencloud.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox