Re: Transactions and Record Locking Help Needed
Posted in 1995
In article <43a33d$m7o@newsbf02.news.aol.com> billkuruc@aol.com "BILLKURUC" writes: > We are implementing transactions into our standard engine database. Make sure you have lots of disk! > We have many programs that have header/detail data where user is entering > a header, then numerous details. Currently we lock header with "select > for update" statement and keep it locked while all other details are > input. Then at end we free up all locks. Erm, yes. > We understand that if we use transactions and "commit" a detail line, we > will lose ALL locks, including the header lock, which would then allow other > users at data which we do not want them to get at while its being updated. Now this is the bit that I *don't* understand: why wouldn't you COMMIT everything at once? Rough program logic follows: BEGIN WORK -- lock header record -- input header changes -- if int_flag then ROLLBACK -- update / add / delete details -- if int_flag then ROLLBACK -- write changed header to disk -- if write failed then ROLLBACK -- delete old details -- write from array -- if any write fails then ROLLBACK COMMIT WORK > Is there any way to stop other users from updating the same header and > detail data automatically ? We discussed setting "header in use" field > manually, but this requires us to write recovery code logic if a process > fatals and "in use" flag remains set when its really not in use. Well, I would just make sure that the users have no way of accessing the detail records directly and only use this program to access the headers *and* details. That should take care of it. > We are thanking you in advance for any suggestions you can provide !!!! It is a pleasure to be making these suggestions !!!! :-) If I haven't made any sense, perhaps it's because I didn't fully understand your problem. If so, please re-post with more details. Cheers, Spokey the Wheeler------------------------------------------------------------- "Billy Boy" - das aufregend andere kondom! Carter - the Unstoppable Sex Machine / Wheeler - the Unstoppable Mail Machine!