Re: Update failed question
Posted in 1995
In article <jxxcpj@salmon.demon.co.uk>, Neil S. Briscoe <Neil@salmon.demon.co.uk> wrote: >In Article <3lchsj$qlj@ftcnews.nrcs.usda.gov> Tammy Croteau writes: >[..explanations deleted..] >>fails >>$BEGIN >>for (i=0; i<600; i++) { >> $UPDATE .... >>} >>$COMMIT >> > >With this one, every update causes a lock and you are running out of locks. >So it bombs. Either, increase your locks or, before that $BEGIN, do a >$LOCK TABLE FOO IN EXCLUSIVE MODE. No, *after* the BEGIN. If you do it *before* the begin, and the database has transactions, the lock will not persist. Each statement not in a BEGIN... COMMIT block is a singleton transaction, and the lock clears immediately after processing the LOCK TABLE statement. In a database with transactions, [UN]LOCK TABLE therefore has no effect except within a BEGIN. (realistically, UNLOCK TABLE isn't used, since COMMIT releases the locks anyway). >Neil S. Briscoe | The Three Stages of Life: >Aldershot, Hants, England | First, you believe in Father Christmas >neil@salmon.demon.co.uk | Then you don't believe in Father Christmas >nbriscoe@cix.compulink.co.uk | And then, you are Father Christmas -- Alan Denney aland@informix.com "I'd quit my job, if I had one and I'd leave my wife, if she hadn't already gone..." -- Trout Fishing in America, "Trouble, Let Me Rest in Peace"