Re: getMoreResults() returns false incorrectly - Mailing list pgsql-interfaces

From Bob Kline
Subject Re: getMoreResults() returns false incorrectly
Date
Msg-id Pine.LNX.4.10.10006201107240.380-100000@rksystems.com
Whole thread Raw
In response to getMoreResults() returns false incorrectly  (Bob Kline <bkline@rksystems.com>)
List 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
(http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame7.html):

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
mailto:bkline@rksystems.com 
http://www.rksystems.com





pgsql-interfaces by date:

Previous
From: Bob Kline
Date:
Subject: getMoreResults() returns false incorrectly
Next
From: Vincent Trussart
Date:
Subject: Postgres JDBC driver : problem with timestamps.