From: | Peter T Mount <pgint(at)maidast(dot)demon(dot)co(dot)uk> |
---|---|
To: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: [INTERFACES] JDBC - update count |
Date: | 1998-01-12 23:23:11 |
Message-ID: | Pine.LNX.3.95.980112232138.27545A-100000@maidast |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Mon, 12 Jan 1998, Herouth Maoz wrote:
> I have a relation with snapshots of rows from another relation. I want to
> update the original relation to new values only if it is still equal to its
> snapshot. For that, I send an update in a PreparedStatement, along these
> lines:
>
> UPDATE rel
> SET col1=?, col2=?, col3=?, col4=?
> FROM snapshot
> WHERE snapshot.id = ?
> AND rel.col1 = snapshot.col1
> AND rel.col2 = snapshot.col2
> AND rel.col3 = snapshot.col3
> AND rel.col4 = snapshot.col4
>
> Well, I assume that if the row in rel is different from the snapshot, I
> will get a row count of zero returned from executeUpdate(). Instead, it
> returns 1 - whether or not the update has actually affected any row.
I think it should return 0 also.
> I checked - the original row is not updated. No other has the new values,
> so no other has been affected. And yet, it returns 1 for both a successful
> and an unsuccessful update.
>
> Is this my problem (misinterpretation of the executeUpdate API)? Or maybe
> it's a bug in the JDBC driver? Or maybe it's a PostgreSQL bug?
I'll look into it, and get back to you.
--
Peter T Mount petermount(at)earthling(dot)net or pmount(at)maidast(dot)demon(dot)co(dot)uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter(at)maidstone(dot)gov(dot)uk
From | Date | Subject | |
---|---|---|---|
Next Message | Steve | 1998-01-12 23:35:06 | subscribe |
Previous Message | Peter T Mount | 1998-01-12 20:06:33 | Re: [INTERFACES] Small bug fixed in PgAccess |