Re: [GENERAL] Resultset problem or BUG !

From: Elie Nacache <elie_nacache(at)yahoo(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [GENERAL] Resultset problem or BUG !
Date: 2004-08-15 14:42:20
Message-ID: 20040815144220.58382.qmail@web54108.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Oliver,

> What is the exception you see?

The exception returned is "Cannot move to index of 0".

> The current development driver (see jdbc.postgresql.org) will treat
> absolute(0) as if you'd called beforeFirst(). Older drivers might do
> something different.

This is exactly the solution. What is the due date of the current development driver ?

Elie

Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
Elie Nacache wrote:

> this.sqlDatas.moveToInsertRow();
> this.updateColumns();
> this.sqlDatas.insertRow();

The JDBC javadoc implies that calling insertRow() leaves the resultset
on the insert row. This is what the driver implements.

> this.sqlLineNumber = this.sqlDatas.getRow(); // INFO >> return 0

As the javadoc says, getRow() returns 0 if there is no current row.
You're on the insert row so there is no current row.

> INFO >> At this step there is no commit
> INFO >> Second step update the row after collecting updated info
>
> this.sqlDatas.absolute(this.sqlLineNumber); // INFO >> throw the
> exception

What is the exception you see?

The current development driver (see jdbc.postgresql.org) will treat
absolute(0) as if you'd called beforeFirst(). Older drivers might do
something different.

> this.updateColumns();
> this.sqlDatas.updateRow();
> INFO >> If I fix the sqlLineNumber to 1 and force the absolute(1)
> then no Execption is thrown but the modification is not seen in the
> table.

Looking at the driver source, it looks like the newly inserted row is
appended to the resultset, so you should find it at the end of the
resultset not the start. (I don't think making this assumption is
portable, though).

-O

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-08-15 15:59:35 Re: [GENERAL] Resultset problem or BUG !
Previous Message Oliver Jowett 2004-08-14 08:03:13 Re: compiling pg from src --with-java and new build.xml