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: | Pine.LNX.4.10.10006201107240.380-100000@rksystems.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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
(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(at)rksystems(dot)com
http://www.rksystems.com
From | Date | Subject | |
---|---|---|---|
Next Message | Constantin Teodorescu | 2000-06-20 17:33:46 | Re: pgaccess deletes function in database |
Previous Message | Bob Kline | 2000-06-20 10:25:15 | getMoreResults() returns false incorrectly |