Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by & Garrett
Tue, 28 Jul 1992 00:21
DBKit: updating key fields
Author: & Garrett
Date: Tue, 28 Jul 1992 00:21
Date: Tue, 28 Jul 1992 00:21
21 lines
1562 bytes
1562 bytes
It would appear that one can't update key fields. When I change non-key fields and then save changes, the sybase table is updated correctly. When I try to save changes that include changes for properties marked as key, I get "Error occured during transaction." It would appear, quite simply, that DBKit builds the where clause of the update statement from the current (changed) values of the key fields rather than from their original values. - The key for this particular table is a five field key. If I change my Model to make one of the key properties non-key, I can then update that field (as long as I don't change any of the remaining key fields, so it can still find the original row). - I can even edit _all_ the key fields so that the row has the same key as another row in the table, so that when I try to save I get "al_appt record has been modified in the database since the last fetch." instead. I think that's proof positive. This is a complete disaster. Any ideas? Any knowledge of plans to fix this? Colin Garrett colin@delphi.bsd.uchicago.edu (NeXTMail)
Re: DBKit: updating key fields
Author: Art Isbell
Date: Tue, 28 Jul 1992 02:53
Date: Tue, 28 Jul 1992 02:53
15 lines
1318 bytes
1318 bytes
Possibly, DBKit is trying to protect you from Sybase (and maybe many other DBMS's). Editting a key field is dangerous because Sybase implements an update as a delete followed by an insert. If the change you have made to a unique key results in a duplicated key (another record with the same key exists), bye-bye record. The insert fails but the delete has already occurred! So maybe the correct way to change a key is to insert a new record with the key changed as you desire and if that succeeds, delete the previous record. -- Art Isbell Cubic Solutions NeXT Registered Developer #745 NeXT software development and consulting Email: isbell@cats.UCSC.EDU Voice: (408)335-1154 USmail: 95018-9442 Fax: (408)335-2515
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads