Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need guidance on transactions
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00659716
Message ID:
00660266
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
>Wrapping up my first all view based app and I wonder if this method of handling the updates looks reasonable. No error trapping or resolution yet - just getting basics down. Thanks.
>
>
>BEGIN TRANSACTION
>SELECT vporders
>llret = TABLEUPDATE(.T.,.F.)
>IF llret
>  SELECT vpordets
>  llret = TABLEUPDATE(.T.,.F.)
>  IF llret
>    SELECT styles
>    llret = TABLEUPDATE(.T.,.F.)
>    IF llret
>      END TRANSACTION
>    ELSE
>      ROLLBACK
>      * option to bail the entire session
>      *!*  =TABLEREVERT(.T.,"vpordets")
>      *!*  =TABLEREVERT(.T.,"vporders")
>      *!*  =TABLEREVERT(.T.,"styles")
>    ENDIF
>  ENDIF
>ELSE
>  THISFORM.goodsave = .F.
>ENDIF
>
>
>Whadaya think?

In respect to style I hate nesting ifs !!!

I would :

BEGIN TRANSACTION
llret = TABLEUPDATE(.T.,.F.,vporders)
llret = llret AND TABLEUPDATE(.T.,.F.,vpordets)
llret = llret AND TABLEUPDATE(.T.,.F.,styles)
IF llret
END TRANSACTION
ELSE
ROLLBACK
THISFORM.goodsave = .F.
ENDIF
Cheers,
Jamie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform