Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Begin & End Transaction
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00056104
Message ID:
00056372
Vues:
32
>>Any idea why the tableupdate in the following code would fail. Note that this is a simplified version of my code. In my application I am actually updating five tables.
>>
>>SET MILTILOCKS ON
>>SET EXCLUSIVE OFF
>>SET DELETED ON
>>
>>USE mytable IN 0 shared
>>=CURSORSETPROP("buffer", 5, "mytable")
>>
>>DELETE FROM mytable WHERE RECNO() <= 500
>>
>>BEGIN TRANSACTION
>>IF !TABLEUPDATE(.T., .T., "mytable")
>> ROLLBACK
>> = TABLEREVERT(.T., "mytable")
>>ELSE
>> END TRANSACTION
>>ENDIF
>>
>>The above test works when I only delete 499 records but when I try 500 it fails. Each record in mytable is 1426 bytes. I also have the same problem if referential integrity deletes the 500 records (cascading delete).
>>
>>Thanks,
>>Shane
>
>Hi Shane,
>
>I believe TABLEREVERT() is an illegal command within a transaction. You probably want something like
>
>BEGIN TRANSACTION
>IF NOT TABLEUPDATE( .T., .T., "MyTable" )
>ROLLBACK
>ENDIF
>END TRANSACTION
>
>Bill

Bill,

I think that the TABLEREVERT should be ok because it follows the ROLLBACK which ends the transaction.

My example program works if I delete fewer records (less than 500). The number of records that I can delete seems to depend on the size of each record.
It's the tableupdate command that is failing. It gets stuck 'Attempting to lock record'.
If I remove the begin/end transaction the tableupdate works fine. It behaves as though there is a maximum amount of information that can be buffered when using begin/end transaction.

Shane
Shane Murdoch
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform