Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
"Andy Kent" — — source: Informix-list mailing list archive (1991-1998)
> You need to trap the error and loop until no status is found then >
lock the
> table. Like the following:
>
> WHENEVER ERROR CONTINUE
> WHILE TRUE
> LOCK TABLE tablename IN EXCLUSIVE MODE
> IF STATUS THEN
> IF SQLCA.SQLERRD[ 2 ] != -113 THEN
> CALL error_handler_routine()
> END IF
> ELSE
> EXIT WHILE
> END IF
> END WHILE
Well nearly: ideally you should call a re-useable routine that tests for
*all* the possible ISAM codes for a lock (and there are lots). Then you
can use that function to test for row-level contention as well.
Don't forget the deadlock ones (-244 and -245), these are returned if you
have SET LOCK MODE TO WAIT <n> .
You might just get away with only testing -113 for table level locks but
then again you might not. (If someone has exclusively locked the
*database*, perhaps...?)
In any case, as I have said elsewhere, I doubt very much if an exclusive
table lock is really what you want. Acquire row locks and test for them.
akent@cix.compulink.co.uk (Andy Kent)
-------------------------------------
+44 117 974 2815
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.