Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Yet another Unique Key generator
Message
De
21/11/1999 20:31:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00293537
Message ID:
00293767
Vues:
26
>You still haven't supported your claim.
>
>something like: (except that we need to see the same value being returned)
>
> 1 machineA append blank
> 2 machineB append blank
> 3 machineA function MkKey( tcFld )
> 4 machineB function MkKey( tcFld )
> 5 machineA llDone = .f.
> 6 machineB llDone = .f.
> 7 machineA do while !llDone
> 8 machineB do while !llDone
> 9 machineA select nCtr ; from KeyCtr ; where kKeyCtr = tcFld ; into array laCtr && A gets 1
>10 machineB select nCtr ; from KeyCtr ; where kKeyCtr = tcFld ; into array laCtr && B gets 1
>13 machineA update KeyCtr ; set nCtr = laCtr[1] + 1 ; where kKeyCtr = tcFld and nCtr = laCtr[1] && counter gets bumped to 2
>14 machineB update KeyCtr ; set nCtr = laCtr[1] + 1 ; where kKeyCtr = tcFld and nCtr = laCtr[1] && nothing happens because there is not record that matches the where clause
>15 machineA if _tally = 0 && 1 record was processed, so _tally = 1
>16 machineB if _tally = 0 && 0 records processed, so _tally = 0
>17 machineA llDone = .t. && Done
>18 machineB loop && Try again
>19 machineA return laCtr[1] && returns 1
>20 machineB do while !llDone
>21 machineB select nCtr ; from KeyCtr ; where kKeyCtr = tcFld ; into array laCtr && Gets 2
>23 machineB update KeyCtr ; set nCtr = laCtr[1] + 1 ; where kKeyCtr = tcFld and nCtr = laCtr[1] && Gets bumped
>24 machineB if _tally = 0 && _tally = 1
>25 machineB llDone = .t.
>26 machineB return laCtr[1] && Returns 2
>
>
>>>Then same response.
>>>>
>>>>Yes. Same issues. I pointed it out in my previous posting, message #293578.
>>
>>
>>Yes, same response. The code will not work in multi-user environment.

You didn't get it. The problem is not with the UPDATE, but the original INSERT. There is nothing to stop two people from inserting the same record.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform