Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning Primary Keys
Message
 
À
28/01/1999 16:29:25
Steve Summers
Pima County Superior Court
Tucson, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00181534
Message ID:
00181735
Vues:
7
Ups!, in the last mail the line [2] was incomplete, sorry, here is fixed.

>I know of no way to place a record lock on the table with all my keys using SQL.

The code in line [2] will place a record lock and the record will be released in line [4]. This is by definition and it is done automatically. The following code it is the core of a key generator routine.

[1]begin transaction
[2] update KeyTable set NextKey = NextKey + 1 where KeyTable.PK = ‘somevalue’
[3] select NextKey from KeyTable where KeyTable.PK = ‘somevalue’
[4]commit transaction

The above code will NOT generate dead-lock conditions because the use of begin transaction/commit transaction.

The table 'KeyTable' will be open automatically for you. Just make sure the database container (DBC) it is open.

> Are you recommending I change the use command to a SQL Select (Which should open the table)?
Yes. Well it is just an idea. I have no idea on the impact that this could have on your project.
Hector Correa
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform