Re: updatable resultsets -> SQLException: -1

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: updatable resultsets -> SQLException: -1
Дата
Msg-id Pine.LNX.4.33.0401210443180.16889-100000@leary.csoft.net
обсуждение исходный текст
Ответ на Re: updatable resultsets -> SQLException: -1  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Ответы Re: updatable resultsets -> SQLException: -1  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Список pgsql-jdbc

On Wed, 21 Jan 2004, Guido Fiala wrote:

> Am Mittwoch, 21. Januar 2004 03:11 schrieben Sie:
> > > rs.updateString(2,"abc");
> > > rs.updateRow();
> > > rs.previous();//show some other record
> > > rs.next();//go back to modified one
> > > //now the above record has strangely enough vanished from my ResultSet
> > > !!! //how do i get it back? (the ResulSet gives me at that position the
> > > values of the previous-record instead) rs.updateString(2,"xyz");
> > > rs.updateRow();//now i get the SQLException -1
> >
> > You have apparently not navigated back to the original row.  The attached
> > program shows the error you are getting.  The error message is completely
> > unhelpful here, but it is your code that isn't working.
>
> The question is for me - would have the above code navigate back to the same record?
>
> For me it looks like this:
>
> (see attached code, it throws no excpetion)
>
> The result is with one next():
> a    b
> 1    zzz
> 2    aaa
> 3    world
>
> But i would expect it should be:
> a    b
> 1    hello
> 2    zzz
> 3    world
>
> Do i need to requery the ResultSet to get the updated record back?
> I would have to remember the primary-key of the record i was editing, to be able to jump back to the correct record
afterrequery. 
> Which would be going through a loop until i find my record again as i can not assume that the records are ordered by
primarykey. 
> What a waste of CPU!
>

This is a bug, and it has been fixed.  If you use the 7.4 series jar file
from http://jbdc.postgresql.org/download.html you should see the correct
behavior.

Kris Jurka


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

Предыдущее
От: Paul Thomas
Дата:
Сообщение: Re: a little disillusioned
Следующее
От: Guido Fiala
Дата:
Сообщение: Re: updatable resultsets -> SQLException: -1