From: | "Paul Stead" <pstead(at)elementallogic(dot)com> |
---|---|
To: | "Dave Cramer" <Dave(at)micro-automation(dot)net>, "Zengfa Gao" <zfgao(at)yahoo(dot)com> |
Cc: | <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Proper state after insertRow |
Date: | 2002-08-23 16:24:57 |
Message-ID: | BNENLMOEFCOIEGKDJMLLMEMGCBAA.pstead@elementallogic.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Dave,
No expert here, but according to JDBC API Tutorial and Reference, 2nd Ed,
from the Java Series:
(pg 596 - top) ".....the application calls the method insertRow. This
method adds the insert row to both the result set and the underlying
database simultaneously. Finally, the application neeeds to position the
cursor on a row back in the result set."
So I would think the cursor stays on the insert row, which is "a special
row, associated with the result set but *not a part of it*", and the
application must move the cursor where it wants from there. As it says "the
application needs to position the cursor on a row back in the result set".
and then
(pg 596 - bottom) "....a result set keeps track of where its cursor was
positioned when the cursor moved to the insert row. As a result, a call to
the method ResultSet.moveToCurrentRow will return the cursor to the row that
was the current row immediately before the method moveToInsertRow was
called."
So IMHO while the cursor remains on the insert row, the inserted row itself
does *not* become the current row, since "the method
ResultSet.moveToCurrentRow will return the cursor to the row that was the
current row immediately before the method moveToInsertRow was called".
Once the application has moved the cursor back to the result set, I don't
think a refreshRow would be needed since insertRow "adds the insert row to
both the result set and underlying database simultaneously."
And finally, once the application has executed insertRow, I don't think they
can update that particular row without moving. I think the insert row stays
a staging area and perhaps you could "stay there" (i.e. leave the cursor
there) and do some more updateInt updateString calls etc., but once you call
insertRow again it will insert yet another new row into the result set and
database providing you have updated all the necessary columns. It would
seem that the insert row should be "cleared" when insertRow is called, so
that if someone didn't treat it like starting over they'd get an exception.
Otherwise it might be a little dangerous.
Anywho, that's how I read all this.....
Hope this helps!
Paul
-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Dave Cramer
Sent: Friday, August 23, 2002 6:48 AM
To: Zengfa Gao
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] Proper state after insertRow
Does anyone know what the state of the result set should be after an
insertRow
Does the result set stay on the "insertRow", does the inserted row
become the current row
should we force the user to do a refreshRow after an insert to pick up
the results of sequences, etc.
after the user executes insertRow, can they then update this row without
moving?
Dave
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2002-08-23 17:38:06 | Re: Proper state after insertRow |
Previous Message | Toby | 2002-08-23 16:24:48 | Re: Tomcat and JDK 1.3.1 Exception problems... |