5 messages in com.mysql.lists.javaRe: Timestamp not updated when using ...| From | Sent On | Attachments |
|---|---|---|
| Jean | 17 Sep 2004 06:48 | |
| Mark Matthews | 17 Sep 2004 14:55 | |
| Rikard Froberg | 18 Sep 2004 03:09 | |
| Jean | 19 Sep 2004 23:44 | |
| Jean | 20 Sep 2004 02:52 |
| Subject: | Re: Timestamp not updated when using ResultSet![]() |
|---|---|
| From: | Mark Matthews (ma...@mysql.com) |
| Date: | 09/17/2004 02:55:58 PM |
| List: | com.mysql.lists.java |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jean wrote:
Hi,
I'm doing updates to records using JDBC but the timestamp field doesn't update.
An example: Address has only two fields Line1 - varchar(40) UpdateTime - timestamp
ResultSet rs = this.doQuery("SELECT * FROM address WHERE address.key = 1",
true);
rs.updateString("Line1", "street addr");
rs.updateRow();
The above does not update the timestamp field UpdateTime
If however I do a query "Update address set line1 = 'street addr' where address.key = 1" Then the timestamp is updated.
Any idea how I can get past this problem?
Jean,
The JDBC driver has to issue an update to cover _all_ the columns in the select in order to implement updatable result sets, so it is explicitly setting the timestamp to the value it retrieved. It does not keep track of whether or not you've actually updated the column (although it could, it starts to get very complex).
Is there a reason you just can't do a plain update query, or not include the timestamp column in the query you create the updatable result from?
-Mark
- -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 332 0507 www.mysql.com
MySQL Guide to Lower TCO http://www.mysql.com/it-resources/white-papers/tco.php -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBS12EtvXNTca6JD8RAg4NAKCdUUQZcXoIBaV568NCNRAqZ5eBpwCeLO9v nTu4gL1qV+OC0hkpwxqSuQ4= =UnYf -----END PGP SIGNATURE-----




