pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
deleteRow or updateRow after insertRow
6+ messages / 4 participants
[nested] [flat]

* deleteRow or updateRow after insertRow
@ 2004-11-18 22:39  jessica xingzc_he <xingzc_he@hotmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: jessica xingzc_he @ 2004-11-18 22:39 UTC (permalink / raw)
  To: pgsql-jdbc

does anyone know why this happen?

I do first:
ResultSet.moveToInsertRow();
ResultSet.update...(1, ...);
....
rs.insertRow(); // a new row inserted into table

but after that, I may move to some other row, say using Result.absolute(..) 
or so, and then
1. update
ResultSet.update...(1, ...);
...
ResultSet.updateRow(); // it does not update the corresponding row in the 
table, but also no
                                     exception thrown.

2. delete
ResultSet.deleteRow(); // throws exception: Can not call deleteRow() when on 
insert row.

anybody has any clue? thanks

zhenchang





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: deleteRow or updateRow after insertRow
@ 2004-11-18 23:26  Dave Cramer <pg@fastcrypt.com>
  parent: jessica xingzc_he <xingzc_he@hotmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Dave Cramer @ 2004-11-18 23:26 UTC (permalink / raw)
  To: jessica xingzc_he <xingzc_he@hotmail.com>; +Cc: pgsql-jdbc

You may need to tell us a little more like what version of the driver 
you are using ?

--dc--

jessica xingzc_he wrote:

> does anyone know why this happen?
>
> I do first:
> ResultSet.moveToInsertRow();
> ResultSet.update...(1, ...);
> ....
> rs.insertRow(); // a new row inserted into table
>
> but after that, I may move to some other row, say using 
> Result.absolute(..) or so, and then
> 1. update
> ResultSet.update...(1, ...);
> ...
> ResultSet.updateRow(); // it does not update the corresponding row in 
> the table, but also no
>                                     exception thrown.
>
> 2. delete
> ResultSet.deleteRow(); // throws exception: Can not call deleteRow() 
> when on insert row.
>
> anybody has any clue? thanks
>
> zhenchang
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly
>
>

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: deleteRow or updateRow after insertRow
@ 2004-11-19 01:51  jessica xingzc_he <xingzc_he@hotmail.com>
  parent: Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 6+ messages in thread

From: jessica xingzc_he @ 2004-11-19 01:51 UTC (permalink / raw)
  To: pgsql-jdbc

The server is 7.4.5, and the jdbc driver is pg74.213.jdbc3.

thanks

>From: Dave Cramer <pg@fastcrypt.com>
>Reply-To: pg@fastcrypt.com
>To: jessica xingzc_he <xingzc_he@hotmail.com>
>CC: pgsql-jdbc@postgresql.org
>Subject: Re: [JDBC] deleteRow or updateRow after insertRow
>Date: Thu, 18 Nov 2004 18:26:44 -0500
>
>You may need to tell us a little more like what version of the driver you 
>are using ?
>
>--dc--
>
>jessica xingzc_he wrote:
>
>>does anyone know why this happen?
>>
>>I do first:
>>ResultSet.moveToInsertRow();
>>ResultSet.update...(1, ...);
>>....
>>rs.insertRow(); // a new row inserted into table
>>
>>but after that, I may move to some other row, say using 
>>Result.absolute(..) or so, and then
>>1. update
>>ResultSet.update...(1, ...);
>>...
>>ResultSet.updateRow(); // it does not update the corresponding row in the 
>>table, but also no
>>                                     exception thrown.
>>
>>2. delete
>>ResultSet.deleteRow(); // throws exception: Can not call deleteRow() when 
>>on insert row.
>>
>>anybody has any clue? thanks
>>
>>zhenchang
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 3: if posting/reading through Usenet, please send an appropriate
>>      subscribe-nomail command to majordomo@postgresql.org so that your
>>      message can get through to the mailing list cleanly
>>
>>
>
>--
>Dave Cramer
>http://www.postgresintl.com
>519 939 0336
>ICQ#14675561
>





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: deleteRow or updateRow after insertRow
@ 2004-11-19 02:14  Oliver Jowett <oliver@opencloud.com>
  parent: jessica xingzc_he <xingzc_he@hotmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Oliver Jowett @ 2004-11-19 02:14 UTC (permalink / raw)
  To: jessica xingzc_he <xingzc_he@hotmail.com>; +Cc: pgsql-jdbc

jessica xingzc_he wrote:

> I do first:
> ResultSet.moveToInsertRow();
> ResultSet.update...(1, ...);
> ....
> rs.insertRow(); // a new row inserted into table
> 
> but after that, I may move to some other row, say using 
> Result.absolute(..) or so, and then
> 1. update
> ResultSet.update...(1, ...);
> ...
> ResultSet.updateRow(); // it does not update the corresponding row in 
> the table, but also no
>                                     exception thrown.
> 
> 2. delete
> ResultSet.deleteRow(); // throws exception: Can not call deleteRow() 
> when on insert row.

Both cases sound like the driver thinks you are on the insert row. Are 
you sure that you are navigating away from the insert row after calling 
insertRow() and are not returning to it for some reason?

Does the problem still occur if you use the latest development driver? 
If so, do you have a testcase that demonstrates it?

It looks like updateRow when on the insert row is handle incorrectly :we 
should throw an exception according to the javadoc, but we silently do 
nothing. I will fix this in the development driver shortly. It won't 
help your problem, though..

-O



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: deleteRow or updateRow after insertRow
@ 2004-11-19 04:34  jessica xingzc_he <xingzc_he@hotmail.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 6+ messages in thread

From: jessica xingzc_he @ 2004-11-19 04:34 UTC (permalink / raw)
  To: pgsql-jdbc

it seems that moveToCurrentRow(), first(), last(), etc. work after 
insertRow(). But using absolute() to navigate some row else does not.

>From: Oliver Jowett <oliver@opencloud.com>
>To: jessica xingzc_he <xingzc_he@hotmail.com>
>CC: pgsql-jdbc@postgresql.org
>Subject: Re: [JDBC] deleteRow or updateRow after insertRow
>Date: Fri, 19 Nov 2004 15:14:51 +1300
>
>jessica xingzc_he wrote:
>
>>I do first:
>>ResultSet.moveToInsertRow();
>>ResultSet.update...(1, ...);
>>....
>>rs.insertRow(); // a new row inserted into table
>>
>>but after that, I may move to some other row, say using 
>>Result.absolute(..) or so, and then
>>1. update
>>ResultSet.update...(1, ...);
>>...
>>ResultSet.updateRow(); // it does not update the corresponding row in the 
>>table, but also no
>>                                     exception thrown.
>>
>>2. delete
>>ResultSet.deleteRow(); // throws exception: Can not call deleteRow() when 
>>on insert row.
>
>Both cases sound like the driver thinks you are on the insert row. Are you 
>sure that you are navigating away from the insert row after calling 
>insertRow() and are not returning to it for some reason?
>
>Does the problem still occur if you use the latest development driver? If 
>so, do you have a testcase that demonstrates it?
>
>It looks like updateRow when on the insert row is handle incorrectly :we 
>should throw an exception according to the javadoc, but we silently do 
>nothing. I will fix this in the development driver shortly. It won't help 
>your problem, though..
>
>-O





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: deleteRow or updateRow after insertRow
@ 2004-11-19 04:56  Kris Jurka <books@ejurka.com>
  parent: jessica xingzc_he <xingzc_he@hotmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Kris Jurka @ 2004-11-19 04:56 UTC (permalink / raw)
  To: jessica xingzc_he <xingzc_he@hotmail.com>; +Cc: pgsql-jdbc



On Thu, 18 Nov 2004, jessica xingzc_he wrote:

> it seems that moveToCurrentRow(), first(), last(), etc. work after 
> insertRow(). But using absolute() to navigate some row else does not.

This could be a problem solved by this fix, if absolute positions you off 
the ResultSet.

date: 2004/06/21 03:11:49;  author: jurka;  state: Exp;  lines: +15 -1
Fix some problems with result sets positioned before the start or
after the end of results.  You could still call a number of methods
on them like getXXX, updateXXX, and updateRow().

I don't recall the details, but you should try build 215 as well as the 
lastest build 308.  If either of these still give you problems, please 
send us a complete java class which we can run, not just snippets of code.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2004-11-19 04:56 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-18 22:39 deleteRow or updateRow after insertRow jessica xingzc_he <xingzc_he@hotmail.com>
2004-11-18 23:26 ` Dave Cramer <pg@fastcrypt.com>
2004-11-19 01:51   ` jessica xingzc_he <xingzc_he@hotmail.com>
2004-11-19 02:14 ` Oliver Jowett <oliver@opencloud.com>
2004-11-19 04:34   ` jessica xingzc_he <xingzc_he@hotmail.com>
2004-11-19 04:56     ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox