Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
If you code like this.... you might be a crappy coder
Message
From
30/05/2021 19:24:55
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
30/05/2021 13:18:14
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680754
Message ID:
01680837
Views:
56
>>Please clarify. A class will not aid in transactions. MaxFrame had classes and everything was done on a shared global connection. It was handled by classes. Is that what you mean?

No I mean all saves/commits handled by a class that encapsulates transaction handling, error trapping etc. So rather than tableupdate() you call a method.

The class could have start/end transaction functions that automatically roll back records after the first tableupdate() fails, or even something like myDB.save("Myview1,myview2,myview3") and because there's multiple views, it splits the parameter apart using alines, wraps a transaction and saves in specified sequence, rolling back if there's a fail. Something like that. If used, it could make adding stuff like transactions more seamless.

>>This code is not modular enough - it's mudular. So I have to inject this approach on a case by case basis.

Gotcha.

Re your client: I can't see the system, but sometimes you want a master record saved even if the subrecord errors, especially if it avoids repeating bucketloads of work. That's a valid reason for sequenced saves without transactions in some situations, even if not yours....
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform