Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why lock() fails.
Message
De
19/10/2001 15:57:45
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00570423
Message ID:
00571096
Vues:
20
>>I have a forms with private data session.
>>
>>Cursors are created in those forms load event with optimistics table buffering.
>>
>>
>>create cursor TEMPCURS from array aStru
>>cursorsetprop( 'Buffering', 5 )
>>
>>
>>Forms have a grid (invoice rows) based on this cursor.
>>This cursor has many relations to tables in LAN server set by SET RELATION command in grid column combobox init event.
>>There are a number of users in network and a number of forms in screen using
>>the same program.
>>
>>I have a command
>>SET REPROCESS TO 30 SECONDS
>>
>>in datasesson init.
>>
>>Users can add rows to this cursor in grid and over-type combobox column contents.
>>
>>I use the following command to store the entered data
>>
>>
>>SELECT TEMPCURS
>>IF LOCK()
>>  REPLACE mydata with relalias.myvalue
>>  unlock
>> else
>>  messagebox('Lock Fails !!!' + str(recno()) )
>>  endif
>>
>>
>>Locking a temporary cursor must be always successful.
>>However, sometimes users get Lock Fail errors and recno() is -2
>>
>>Why LOCK() command fails in this situation sometimes?
>
>Andrus;
>
>I could be wrong but when you do a Create Cursor, you are creating a temporary cursor that is opened exclusively. Could this be part of your problem?

Yes, cursor is opened exclusively and it uses optimistics table buffering.
Users enters invoice rows to in. After that I add those entered rows
to invoice row table using COPY TO and issue a tablerevert(). After that cursor becomes
empty and new invoice rows are entered. This process repeats hundreds of times.
There are many of such forms in screen and many users in LAN using same program.
This cursor in related to Item and other global tables in LAN. It may me possible that same item is entered in different workstations. Hower, I expect that lock() and replace will not place lock to other tables.
All of those rows are buffered (recno() is negative). Buffering will never be commited, only COPY TO and tablerevert() is used.

I cannot use local view since invoice row table doesn't have unique key field.
Andrus
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform