>I wanted to find a way to easily set and restore SET commands. The goal was
>to set them at the top of a procedure, then restore them when the procedure ends.
>
>So I came up with this small class. It stores the current value of a SET command
>and when destroyed, restores the setting.
>
>Feedback wanted. ThanksYep. That's the standard way to use the benefits of OOP, letting the objct handle state and restore destroy, so you do not have that responsibility, and the problem of forgetting to restore.
Many OOP Frameworks in the market have this in one form or another (at least the one commercial one I use does).
Another way would be not to segregate all SETs into their one function/method, but do a tgeneric one for most SETs where you pass the setting you want as a parameter (TALK/CONFIRM/SAFETY/etc)
For individual ones you can also add a set of objects to keep the current ALIAS() before a SELECT xxx, to keep FULLPATH(CURDIR()) before a SET DEFAULT TO (or CD), to save/restore PATH, to save/restore controlling index tag, and anything else you can think of.