Xref: utzoo comp.databases:2865 comp.sys.ibm.pc:30918 comp.dcom.lans:3094 Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!rutgers!bpa!dsinc!wells!mdi386!bruce From: bruce@mdi386.UUCP (Bruce A. McIntyre) Newsgroups: comp.databases,comp.sys.ibm.pc,comp.dcom.lans Subject: Re: Concurrency Control + Question Summary: USE filename INDEX filename EXCLUSIVE && for exclusive use Message-ID: <96@mdi386.UUCP> Date: 1 Jul 89 02:47:17 GMT References: <25232@shemp.CS.UCLA.EDU> <221@ic2020.UUCP> Organization: Wells Computer Systems Corp., Levittown, Pa. 19058 Lines: 47 In article <221@ic2020.UUCP>, jim@ic2020.UUCP (Jim Carter) writes: > in article <25232@shemp.CS.UCLA.EDU>, gblee@maui.cs.ucla.edu says: > > Please consider the following problems: ... > The simple foxbase+ code to lock and edit a record is > find name && lookup the correct record. > if rlock() && returns true if record lock successfull. > edit && edit this record. ( or modify somehow ) > unlock() && unlock all locks you have set > else > ... display message, that you can not lock this record. > endif > MY QUESTION: > The only problem I have had is on some operations that could effect ALL > records, Exclusive access is required. I have not found a simple way > to gain exclusive access. Anyone have a simple solution ? > > --Geunbae Lee,m UCLA-CS-AI. The simple way is to do the following... USE filename INDEX index1,index2 EXCLUSIVE ** if using CLIPPER IF NETERR() RETURN ENDIF DELETE ALL FOR condition PACK CLOSE DATABASE This will give you exclusive use. I will mail you my standard openfile that does all of the good stuff, ok? You can use it as follows: STORE .F. TO error,lockfile DO openfile WITH "1","filename","index1,index2",key,filter,lockfile,error IF .NOT. error DO processing ENDIF DO closfile WITH "DBF",error This will do all of the checking needed, under foxbase+. I use this every place I do file access under DOS or XENIX or LAN's. bruce -- ========================================================================= Bruce A. McIntyre, McIntyre Designs, Inc. VOICE(215)322-1895 143 Bridgetown Pike, Langhorne, Pa. 19047 DATA (215)357-2915 {wells|lgnp1}!mdi386!bruce bruce@wells tbit+ Unix, Xenix, Netware and PC-DOS Applications development. Specializing in Database Applications since 1980.