Re: getUdateCount() vs. RETURNING clause

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: getUdateCount() vs. RETURNING clause
Дата
Msg-id hej5r1$aqs$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: getUdateCount() vs. RETURNING clause  (Oliver Jowett <oliver@opencloud.com>)
Ответы Re: getUdateCount() vs. RETURNING clause
Список pgsql-jdbc
Oliver Jowett, 25.11.2009 12:13:
>
> You've done some selective editing there. The javadoc I referred to is
> this (from the Java 6 javadoc):
>
> getResultSet():
>
> Retrieves the current result as a ResultSet object. This method should
> be called only once per result.

Correct, once per *result* not per statement. If the statement returns more than one result, I should be allowed to
callit multiple time.  

I think the base of my (mis)understanding is that the term "current" lead me to believe that the "stack" of results a
statementcan hold, could look like this: 

resultSet
update count = 3
update count = 2
resultSet
reslutSet

So if I create a loop using the condition stated in the Javadocs the program flow would be as follows:

1) stmt.execute() returns true, so I call getResultSet()
2) getMoreResults() returns false, but getUpdateCount() returns 3 ==> go on
3) getMoreResults() returns false, but getUpdateCount() returns 2 ==> go on
4) getMoreResults() returns true, so getResultSet() returns a result set ==> go on
5) getMoreResults() returns true, so getResultSet() returns a result set ==> go on
6) getMoreResults() returns false, getUpdateCount() returns -1 ==> everything was processed.

Apparently this interpretation of "current", "next" and "once per _result_" was wrong...

Regards
Thomas

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: getUdateCount() vs. RETURNING clause
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: getUdateCount() vs. RETURNING clause