This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: beginner's help on Locking From: "John M. Dlugosz" <john@dlugosz.com> Date: Sat, 16 Sep 2000 17:11:00 -0500 I want to do the following: accept a user name and other information via a form, then generate a new ID and add all the info as a new row to by UserID table. I check that the name doesn't already exist (exit and tell him to log in instead), and check that the generated ID is unique. However, that is obviously a race condition. How do I lock the table from the time I check the current contents through when I add a new row? I can't find anything in the supplied docs or FAQ about locking. Not one bit! This is an Access database under Windows, via the ODBC driver. === Subject: RE: beginner's help on Locking From: Ilya Sterin <ideas_pc@usa.com> Date: Sat, 16 Sep 2000 23:26:01 -0400 (EDT) Why not create a unique field and that way even if something goes in at that time by the same name, it will reject when you try to insert. === Subject: RE: beginner's help on Locking From: "John M. Dlugosz" <john@dlugosz.com> Date: Sat, 16 Sep 2000 22:44:41 -0500 The fields in question are unique, and one of them is the primary key. But I'd have to parse the errorstring to figure out what went wrong, and that's just not elegant. Also, it doesn't generalize to other situations. I still want to learn how to lock. --John -----Original Message----- From: Ilya Sterin [mailto:ideas_pc@usa.com] Sent: Saturday, September 16, 2000 10:26 PM To: John M. Dlugosz; dbi-users@isc.org Subject: RE: beginner's help on Locking Why not create a unique field and that way even if something goes in at that time by the same name, it will reject when you try to insert. Ilya Sterin ------Original Message------ From: "John M. Dlugosz" <john@dlugosz.com> To: <dbi-users@isc.org> Sent: September 16, 2000 10:11:00 PM GMT Subject: beginner's help on Locking I want to do the following: accept a user name and other information via a form, then generate a new ID and add all the info as a new row to by UserID table. I check that the name doesn't already exist (exit and tell him to log in instead), and check that the generated ID is unique. However, that is obviously a race condition. How do I lock the table from the time I check the current contents through when I add a new row? I can't find anything in the supplied docs or FAQ about locking. Not one bit! This is an Access database under Windows, via the ODBC driver. === Subject: RE: beginner's help on Locking From: Paul Lukins <plukins@flashcom.net> Date: 18 Sep 2000 08:18:09 -0700 http://www.mysql.com/documentation/mysql/commented/manual.php?section=LOCK_TABLES === Subject: RE: beginner's help on Locking From: "John M. Dlugosz" <john@dlugosz.com> Date: Mon, 18 Sep 2000 18:05:42 -0500 So, is this command "standard" SQL, or is it specific to the "mySQL" product described in those pages? I'm using Access. === Subject: Re: beginner's help on Locking From: Paul Lukins <plukins@flashcom.net> Date: Mon, 18 Sep 2000 19:10:29 -0700 In that case, open Access, click help, type in 'locking' and press search. When I do this in Access 2000, I get a whole heap of information regarding locking strategies: <snip> About choosing a record-locking strategy in an Access database in a multiuser environment When you edit a record, Microsoft Access can automatically prevent other users from changing the record before you have finished editing it. ===