Re: Best Method for Updating a record
Posted in 1993
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
>Achim Reiners (ar@mai.de) wrote: >: Well, guys, I'm thinking of a methodological problem: >: I'm working with Informix just for some weeks (SYBASE before). >: How to do updates to a table in respect of concurrency in the best way? >: There are some solutions to do this: >: 1.) Lock the record from the time it is read until it is rewritten. I am not a very sophisticated 4GL programmer but i think that simply locking the record is the way to go. >: This has as I think some problems: >: a.) The first is that the record is locked for a long time if the >: user takes a coffie break or something else without unlocking >: the record. So in this case other applications can not access >: the record may be for a long time. A user is responsible to terminate the programm before he goes home! Let me put it that way: you don't integrate an automatic that turns the motor of you car off after 10 minutes of standing still?! And thats just because the effort to integrate such an automatic wouldn't pay off. >: b.) On the other hand, what happens if the user`s application fails >: before unlocking the record? You lock a record within a transaction. When your program is terminated the sqlexec process will remove the lock. >: c.) The application probably already at reading time has to know if >: writing has to be done (maybe records are locked that will not >: be rewritten). That's trivial if you design your programs that way. For example make a distinction between viewing data and editing data. A r n d PS.: Seit wann hat den MAI einen Internet - Anschluss?