Structuring code: showing debug info #412
pchemguy
started this conversation in
Show and tell
Replies: 1 comment
-
Thanks for sharing @pchemguy ! This is helpful, and looks great. For everyone, here is a screenshot of what the results look like: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
sqlpage.variables()
function provides POST/GET functions information. The returned GET variables include "local" variables defined via the standalone SET statement and GET URL parameters. A convenient way to output these variables is using the "table" component and a slightly modified code from the SQLpage docs. For SQLite, I place the code shown below at the bottom of a module.I added the $DEBUG filter to display this information only when the URL includes the DEBUG=1 GET parameter. I also sort the lists for more convenient navigation. To distinguish GET parameters from local variables defined via SET, I consider adopting the convention of adding the underscore prefix to local variables, for example,
SET $_sqlite_version = SELECT sqlite_version();
. Then, I can use this convention to group locally defined variables and GET parameters via an additional sort key, as illustrated below.Debug code placed at the bottom of a module
Beta Was this translation helpful? Give feedback.
All reactions