Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BEGIN Transaction
Message
De
08/10/1999 09:01:48
 
 
À
08/10/1999 02:08:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00274085
Message ID:
00274160
Vues:
35
>Hi,
> I am using BEGIN TRASACTION to update multiple table in a process as the following: (my tables are set buffering - 5)
>
>>INSERT INTO Topup (Trans_No, Card_ID, Topup_Amount, Topup_DateTime) ;
> VALUES (lcTrans_No, lcCard_ID,
>>BEGIN TRANSACTION
>>lnUpdated = TABLEUPDATE(.T.,.T.,'Topup', laError)
>>IF lnUpdated
>>SELECT Member
>>REPLACE Total_Sum WITH Total_Sum + lnTopup ;
> Balance WITH lcTotal
>>ELSE
>>ROLLBACK
>>= TABLEREVERT(.T.)
>>RETURN
>>ENDIF
>**Read and Process CommPort Data/****
>>IF ReadComm() = "Failed"
>>ROLLBACK
>>= TABLEREVERT(.T.)
>>RETURN
>>ELSE
>>END TRANSACTION
>>ENDIF
>
>My question are:
>1. If any of my process above failed, will the tabled REVERTED without error? I used to get error TABLEREVERT() is not supported for TRANSACTION. However, the example is help file do so too... Therefore I tried to write =TABLEREVERT(.T.) a few spaces in front of rollback as the following:
>>>>>>>>ROLLBACK
>>>>=TABLEREVER(.T.)
>It works OK alreadi, is it really OK for these code?
>
>2. If there is error that need the update process to be reverted by my procedure (e.g. readcomm failed), I failed to TABLEREVERT(.T.) it. I will get .F. if I update the same record again with ReadComm Successfully even. It caused by the uniqueness of primary key. But I have already issued TABLEREVERT()!!!
>


Why don't you end the transaction, and then revert?

>3. I got error "Data session #2 could not released without end transaction". What is the mistake? I will get this if I revert my table and quit.

THat's because your RETURN statement causes the routine to exit before the transaction is closed. A TABLEREVERT() is not the equivalent of an END TRANSACTION.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform