#

| Chapter 12 PLVio: Reading and Writing PL/SQL Source Code |

## 12.8 Saving and Restoring Settings

The PLVio package is used by many PL/Vision packages and now you can use it as well. Code reusability is a wonderful thing, but it can get awfully dicey if one program's use of PLVio steps on another program's reliance on settings and data from PLVio. To help avoid such conflicts, PLVio can automatically save and restore its settings for the source and target repositories.

You get to decide when and if saves and restores should take place. To turn on saves/restores for the source repository, call the `savesrc` procedure (the default is to perform save/restores automatically). You can disable save/restore on source by calling the `nosavesrc` procedure. Finally, you can determine the current status of save/restore on source by displaying the value returned by the `saving_src` function. The headers for these programs are shown below:

>     PROCEDURE savesrc;
>     PROCEDURE nosavesrc;
>     FUNCTION saving_src RETURN BOOLEAN;

To turn on saves/restores for the target repository, call the `savetrg` procedure (the default is to perform save/restores automatically). You can disable save/restore on the target by calling the `nosavetrg` procedure. Finally, you can determine the current status of save/restore on target by displaying the value returned by the `saving_trg` function. The headers for these programs are shown below:

>     PROCEDURE savetrg;
>     PROCEDURE nosavetrg;
>     FUNCTION saving_trg RETURN BOOLEAN;

The save/restore facility does not maintain a stack of settings. If you save on top of a previous save, the former save settings are wiped out.

> NOTE: The values associated with the current source and target are saved, but the current position in a cursor or file, for example, cannot be maintained with a simple call to `savesrc` or `savetrg`. If you switch source or target in the middle of getting or putting data, you will not be able to rely on a restore to put you right back where you were.

12.7 Writing to the Target |  | 12.9 Cleaning Up Source and Target

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.