SQL Miscellaneous
From TeamDeveloperWiki
This page covers miscellaneous SQL tips & tricks.
Contents |
Evaluate/debug sql-statement bind variables
When your sql statement contains many bind variables it can be difficult to debug which values these bind variables have when executed.
While in debugmode you will have to evaluate every bind variable manually.
The following custom function is able to evaluate the supplied Sql statement and show all current values
for each bind variable.
sSqlEvaluation = PALEvaluateSqlStatement( sSqlStatement, SalContextCurrent( ) )
You can for instance use this to offer a runtime sql debugging feature.
When you enable some kind of debugmode at runtime (eg using a global boolean to indicate to debug sql's)
call this function and show the result in a message box or in a custom window.
This will give quite nice information what data is used in the sql statements just before the actual statement is executed.
A sample how to use the function and how the evaluated statement looks like:
At the left the actual sql statement is listed. At the right this statement is evaluated.
In place of the bind variable names the current values are shown.
Here you can download the sample:

