Set Explain

Problem: How can I Embed SET EXPLAINS in Code?

I'd like to be able to imbed diagnostics capabilities into my programs so that I could use an environment variable to turn on and turn off the SET EXPLAIN command at will. How do I do that?

Solution: Use an environment variable.

Before running the code set an environment variable want explain = "Y." Early in the code, after the connection to the database is made, include some code similar to this pseudocode:

retrieve the environment variable into wantenv
if wantenv == "Y"
EXEC SQL SET EXPLAIN ON;
else
EXEC SQL SET EXPLAIN OFF;
done

If you use this technique, be sure that the environment variable is set to "N" by default in your environment, since the output files from SET EXPLAIN can grow very large very quickly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.153.38