Skip to content

Display_execution_context

Paweł Salawa edited this page Jan 15, 2018 · 1 revision

Definition

Language: Qt Script
Plugin for language: ScriptingQt
How to use: Create custom SQL function. Suggested name: displayContext
Function arguments undefined, user's choice
Function usage: SELECT displayContext('some argument', 5, 2.34)
Description: It inspects all local variables and displays them, together with their types. Example result of above usage would be:
                        typeof this = object
                        arguments[0] = some argument (string)
                        arguments[1] = 5 (number)
                        arguments[2] = 2.34 (number)                                                                                       |

Code

var n, arg, name;
var res = "";
res += "typeof this = " + typeof this + "\n";
for (name in this) {
    res += "this[" + name + "]=" + this[name] + "\n";
}
for (n = 0; n < arguments.length; ++n) {
    arg = arguments[n];
    res += "arguments[" + n + "] = " + arg + " (" + typeof arg + ")\n";
}
return res;