Skip site navigation (1) Skip section navigation (2)

Re: getMoreResults() returns false incorrectly

From: Bob Kline <bkline(at)rksystems(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: getMoreResults() returns false incorrectly
Date: 2000-06-20 15:08:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
On Tue, 20 Jun 2000, Max Khon wrote:

> hi, there!
> try `stmt.executeQuery(...)' instead of `stmt.execute(...)'

Thanks for the suggestion, but the two methods are intended for
different purposes.  The former is appropriate when you know in advance
there is exactly one result set produced by the query.  The latter is
intended to be used (in the words of the Javadoc documentation) when
working with "an unknown SQL string" which might return zero, one, or
multiple result sets.  I need the latter functionality, so
executeQuery() isn't appropriate in this case.

Here's the description of the execute() method and its supporting
methods from Sun's JDBC documentation

7.1.4 Optional or multiple ResultSets

Normally we expect that SQL statements will be executed using either
executeQuery (which returns a single ResultSet) or executeUpdate (which
can be used for any kind of database modification statement and which
returns a count of the rows updated).

However under some circumstances an application may not know whether a
given statement will return a ResultSet until the statement has
executed. In addition, some stored procedures may return several
different ResultSets and/or update counts.

To accommodate these needs we provide a mechanism so that an application
can execute a statement and then process an arbitrary collection of
ResultSets and update counts. This mechanism is based on a fully general
"execute" method, supported by three other methods, getResultSet,
getUpdateCount, and getMoreResults. These methods allow an application
to explore the statement results one at a time and to determine if a
given result was a ResultSet or an update count.

Bob Kline

pgsql-interfaces by date

Next:From: Constantin TeodorescuDate: 2000-06-20 17:33:46
Subject: Re: pgaccess deletes function in database
Previous:From: Bob KlineDate: 2000-06-20 10:25:15
Subject: getMoreResults() returns false incorrectly

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group