Newsgroups: comp.lang.perl
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!uw-beaver!fluke!gtisqr!roger
From: roger@mav.com (Roger Droz)
Subject: Re: need advice - writing a database system
Message-ID: <1991May06.205506.9374@mav.com>
Keywords: database, dbm
Organization: Maverick International Inc.
References: <1991May3.093532.19393@ccu.umanitoba.ca>
Date: Mon, 06 May 91 20:55:06 GMT
Lines: 28

In article <1991May3.093532.19393@ccu.umanitoba.ca> rahard@eeserv.ee.umanitoba.ca (Budi Rahardjo) writes:
>4. Access to the database by more than one persons at the same time
>   is desireable.
>   How would you lock the database when you perform critical operations,
>   like add a new entry, or updating a record ? (Use perl lock ? or
>   just create a file, say  "lock.db", then remove it after you're done ?)

I have a very old perl ($Header:  perly.c,v 3.0.1.5 90/03/27 16:20:57
Patch level:  18), but I think my experience will apply to all but the
lastest and greatest perl with the special patch for gdbm.

Gdbm permits multiple database readers, but only a single writer may
have the database open.  For that reason, I have always closed perl
dbm associative arrays before descending to human speed to ask for
input.

My old perl seems to open all dbm files for write access, if
permissions allow.  The patch that I haven't yet tried looks like it
passes "open for read-only" to gdbm, but you still have the problem
that gdbm won't allow two writers or a simultaneous writer and reader.
____________
               Roger Droz                  Domain: roger@mav.COM           
()       ()    Maverick International      UUCP: uw-beaver!gtisqr!roger
 (_______)     Mukilteo, WA 
  (     )      
   |   |       Disclaimer: "We're all mavericks here: 
   |   |                    Each of us has our own opinions,
   (___)                    and the company has yet different ones!"
