Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ID field
Message
De
17/11/2006 08:13:13
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01170010
Message ID:
01170645
Vues:
10
>>>>>Hi everybody,
>>>>>
>>>>>AFAIK there is no way in multi-user environment to have ID field incremented correctly without using extra table to keep the last ID (if we're not using autoincrement field). Using go bottom, grab the last number and start from there doesn't prevent two users from taking the same ID. Even if we put a check right after for the existance of ID.
>>>>>
>>>>>What do you think? Given only one table and no auto-increment is it possible to correctly auto-increment in multi-user environment?
>>>>>
>>>>>Thanks.
>>>>
>>>>There is no need to increment an ID field. Use GUID.
>>>>Cetin
>>>
>>>It's not really an ID. It's Invoice Number.
>>
>>Invoice numbers are human generated things, no?
>>Else no luck, there would be gaps or higher ID with earlier date situations (in theory there is no way, in practice there shouldn't be).
>>Think of this you and me request new ID almost at the same time, you get 25 and I get 26. So far so good. However you decide to cancel insertion, I insert. Next day someone comes and gets 25 or 27. Both have different problems, one is out of sequence time wise, other is leading to gaps.
>>However there is one way, assign the ID during commit, not before and prevent deletes. That means for a fox table you could simply use committed record's recno as ID. On an invoicing system these might be acceptable (no deletion etc).
>>Cetin
>
>Cetin,
>
>Thanks a lot for your response. I agree with what are you saying. Unfrotunately, the system is already designed and AFAIK now there are only patches and sometimes new menu choices (reports) added. The system was written about 10 or more years ago and patched either since. Taking all of this into consideration I think the solution implemented by my colleague (I delegated the task, since I can not do more than 5 tasks simultaneously) using FLOCK() should work. I don't know yet, how would it affect the system performance wise.

Naomi,

You appear to neglect my solution: Re: ID field Thread #1170010 Message #1170230

Using FLOCK() is unnecessary and unwise.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform