jim@ic2020.UUCP (Jim Carter) (06/30/89)
in article <25232@shemp.CS.UCLA.EDU>, gblee@maui.cs.ucla.edu says: > > Please consider the following problems: ... We have a similar problem, which we have basically solved the problem by using xenix and foxbase+. If you are using dbase3+, I beleive you have the same record/file locking available to you. The record locking available in sco foxbase+ is quite nice. I have no idea what effects this would have on your network system. It has very little effect on our system. As far as paradox, Never used it but I would think the record/file locking is similar in use. 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 ? > Don't simply say you have to buy expensive Distributed DBMS or Minicomputer. > What is the constsructive solution for this problem? As far as constructive solution, my experience has shown that you do get what you pay for in the concurency area. I do think a larger system is better in the long run, but your network will do the job. > --Geunbae Lee,m UCLA-CS-AI. -- Jim Carter (Sequoia Contact Lens,1355 11th Street,Reedley,CA,93654) {...!csufres!csuf3b!ic2020!jim} 209/638-3939, Fax 209/638-5433
bruce@mdi386.UUCP (Bruce A. McIntyre) (07/01/89)
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.
COSCB0G@uhvax1.uh.edu (InSik Kim) (07/04/89)
In article <96@mdi386.UUCP>, bruce@mdi386.UUCP (Bruce A. McIntyre) 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. That can be done same way as record locking, i.e. USE filename ..... && use database file if FLOCK() && returns true if flie lock successful ... ... && do the operation ... UNLOCK() && unlock the file else ... display message endif or, if you want to lock it in loop with time out, STORE nnn TO time_out && nnn is time_out period USE filename && use database file STORE 0 TO time && initialize time DO WHILE time <= time_out .OR. FLOCK() STORE time+d_time TO time && d_time is time interval ENDDO IF time > time_out && file locking failed ... display message for failure and prepare exit ENDIF ... && do the necessary operation ... UNLOCK() ========================================================================= InSik Kim University of Houston, University Park 4700 Calhoun, Houston, TX 77004 InterNet Address iskim@crcc.uh.edu iskim@cs.uh.edu =========================================================================