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 ...
Get Informix DBA Survival Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.