last man wins. ----- Original Message ----- From: "gerald_clark" <[EMAIL PROTECTED]> To: "Cal Evans" <[EMAIL PROTECTED]> Cc: "MySQL" <[EMAIL PROTECTED]> Sent: Wednesday, April 02, 2003 11:10 AM Subject: Re: How Many
> A Checks for empty > B Checks for empty > A Updates > A Reads ( and owns record ) > B Updates > B Reads ( and owns record ) > > Now What? > > Cal Evans wrote: > > >No. You check for empty. update, check again to make sure you now own it. > >The userid is either going to be you OR someone else. not both. It it's you > >then you own the record. If it's someone else then someone slipped in and > >grabbed it from you. > > > >=C= > >----- Original Message ----- > >From: "gerald_clark" <[EMAIL PROTECTED]> > >To: "Cal Evans" <[EMAIL PROTECTED]> > >Cc: "Ed Kiefer" <[EMAIL PROTECTED]>; "MySQL" <[EMAIL PROTECTED]> > >Sent: Wednesday, April 02, 2003 9:22 AM > >Subject: Re: How Many > > > > > > > > > >>Cal Evans wrote: > >> > >> > >> > >>>Ed, > >>> > >>>1: It depends on your hardware. I don't think MySQL imposes a > >>> > >>> > >restriction. > > > > > >>>2: It doesn't work that way. It's not like VFP or Access where you > >>> > >>> > >'edit' a > > > > > >>>record. You can SELECT the contents of a record, you can manipulate them > >>> > >>> > >and > > > > > >>>then you can UPDATE that record (assuming you have a primary key) but the > >>>last person to issue an update is the one who wins. > >>> > >>>One thing I've done in the past is use 'soft locks'. Basically if you > >>> > >>> > >HAVE > > > > > >>>to insure that while someone has requested the right to edit a record, no > >>>one else can do it you have to enforce it in your own software. > >>> > >>>A soft lock is simply a couple of fields in a record. usually a userID > >>> > >>> > >and a > > > > > >>>timedate field. When someone requests permission to edit a record I do: > >>> > >>>1: Make sure the userid field is empty > >>>2: UPDATE the record with this users userid and the current timedate. > >>>3: SELECT the record again and make sure that this user's userid is the > >>>current one. (Keeps someone from slipping in on ya.) > >>> > >>> > >>> > >>There is still a window of opportunity for an error here. > >>You can both check for empty, then both update and read. > >>Now two users believe they have the record. > >>Update therecord set userid=concat(userid,'|','me') where id=thisnumber; > >>select userid from the record where id=thisnumber. > >> > >>Now: > >>If the user is '|me' , I am the owner. > >>If it is '|me|someoneelse' , I am still the owner. > >>If it is '|someoneelse|me', I am not the owner. > >> > >> > >> > >>>4: Allow them to edit the record > >>>5: Commit the record and clear the userid. > >>> > >>>If there IS a userid already on the record, I check the timestamp. If > >>> > >>> > >it's > > > > > >>>more than x time units (10 minutes, 2 hours, 3 days, etc) old, I > >>> > >>> > >invalidate > > > > > >>>the lock by going to step 2 anyhow. > >>> > >>>Clear as mud? > >>> > >>>=C= > >>>----- Original Message ----- > >>>From: "Ed Kiefer" <[EMAIL PROTECTED]> > >>>To: "MySQL" <[EMAIL PROTECTED]> > >>>Sent: Tuesday, April 01, 2003 7:40 AM > >>>Subject: How Many > >>> > >>> > >>> > >>> > >>> > >>> > >>>>How many people can be accessing the same mysql database at the same > >>>> > >>>> > >time? > > > > > >>>>Can several people work on the same record at the same time? > >>>> > >>>> > >>>>-- > >>>>MySQL General Mailing List > >>>>For list archives: http://lists.mysql.com/mysql > >>>>To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >> > >>-- > >>MySQL General Mailing List > >>For list archives: http://lists.mysql.com/mysql > >>To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > >> > >> > >> > >> > > > > > > > > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]