Foxhound is the better* Database Monitor for SQL Anywhere.
*better: More thorough, more relevant, more effective.
...more Alerts, more All Clears, more details, more control in your hands.
|
Breck Carter
Last modified: November 9, 1998
mail to: bcarter@bcarter.com
PowerBuilder has a method for determining where you are in the script. This can be accomplished by "faking out the error object". If you assign a null object to a normal object you will be triggering an error. A SystemError script can capture the line you errored on and the object you are in. This method can be taken further by creating custom objects in which you define whatever additional information you require.
Igor Dvorkin, Senior PB Consultant, igor@reach.net
Because Igor's tip works flawlessly, and because I was skeptical at first, he gets a double "Way Cool!" award! It took only a few minutes to enhance the profiler and the result can be seen in Figure 1: line numbers and object, event and function names are automatically added to the profile point descriptions.
Well, not quite automatically, but almost so. First you have to paint a Standard Class User Object based on PowerBuilder's error object, declare an instance of that object as a global variable, create it in the application open script, and code a SystemError script to copy each attribute from the built-in error object to the new global variable. The next step is to add code to the profiler to display those attributes.
Figure 1: Profiler With Line Numbers
All that remains is to force SystemError to fire whenever the f_prof_xxx functions are called. The easiest way is to paint another user object, this time a Custom Class object with a single integer instance variable. Declare an instance of that object as another global variable but don't add any code to create it; after all, we're trying to force an error. For ease of coding these errors, give this global variable and its instance variable very short names, such as g and i.
Listing 1 shows the code that produced the first entry in Figure 1. Incrementing a variable that doesn't exist causes SystemError to fire, and because the code is on the same line as the call to f_prof_section the error object attributes point to that very spot in your code. Like I said, way cool!
Breck
Listing 1: Line 5 in cb_GI.clicked
g.i++ ; f_prof_section ( 'GI' )
Breck Carter can be reached by phone at (416) 763-5200 or via email at bcarter@bcarter.com.