Re: Locking on informix
Posted in 1997
> Centura 1.1.1. PATCH 2 > NT-Client 4.0 > Informix On-Line 7.22C1 > Windows NT 3.51 > > > > We are using Centura 1.1.1. on an Informix On-Line Database. > We added an extra field on every table to check the locking. > That field contains the current (03-12-1997 12:30:25.000). > The moment that you try to do the update, we are checking > if another user has changed the record since we have that > record on the screen using that datetime field. > If the record has been changed, the user gets a warning > on the screen : Record has been changed by another user ! > Windows NT never gives you the fractions of seconds. If > two users do the update on the same second, the system > doesn't give you the warning ! > > How do you check locking on Informix ? > > > Franky Thiel > INFOHOS@UNICALL.BE > hallo Franky, try use this schema: ensure, that only one user can have in same time on the screen same data for editing. For instance use login instead of current. Before displaying lock exclusive that data, check whether column is empty and if so, update it by the user login -> and commit of course. If there is already its own login, then can use is read/write too, else will data see only in read-only mode. Now user can safely edit data with exclusive access and each other will have access only read-only. After editng data you empty this column. This of course assume that each user have its own login, an will be logged from only one client in the same time. There is problem with user which have "locked data" and will leave to lunch, ... but this can be solved by setting timeout for editing and then automaticaly switch to RO mode or close editing dialog. Another problem is crashed client (data will still locked) This you can solve for example by timed stored procedure (check for locked data vs. existing connect) HTH ado Adrian Simo SWH spol s r.o. Stromova 9, 842 37 Bratislava, Slovakia