Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need guidance on transactions
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00659716
Message ID:
00660266
Views:
14
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform