In PowerBuilder 10.2, the database trace utility makes time measurements in microseconds rather than milliseconds, and includes a configuration dialog box that lets application users set the level of detail to be logged in the trace output file. Application users can also set the output file name and path. The configuration dialog box can be accessed at design time or runtime. It replaces a message box that merely informed the user that database tracing was enabled.
Suppressing the configuration dialog box When tracing components on a transaction server such as EAServer, it might be useful to hide the configuration dialog box. You can do this by setting a ShowDialog registry setting. To change this setting, see "Registry settings for PBTrace".
You can display the following items in the database trace file:
- Bindings Metadata about the result set columns obtained from the database
- Fetch buffers Data values returned from each fetch request
- DBI names Database interface commands that are processed
- Timing Time required to process DBI commands; the interval is measured in thousandths of milliseconds (microseconds)
- Sum timing Cumulative total of timings since the database connection began; the timing measurement is in thousandths of milliseconds
Registry settings for PBTrace
The selections made in the configuration dialog box are saved to the registry of the machine from which the database connections are made. Windows registry settings for the database trace utility configuration are stored under the HKEY_CURRENT_USER/Software/Sybase/PowerBuilder/10.0/DBTrace key. Registry strings under this key are: ShowBindings, FetchBuffers, ShowDBINames, Timing, SumTiming, LogFileName, and ShowDialog. Except for the LogFileName string to which you can assign a full file name for the trace output file, all strings can be set to either 0 or 1.
The ShowDialog registry string can be set to prevent display of the configuration dialog box when a database connection is made with tracing enabled. This is the only one of the trace registry strings that you cannot change from the configuration dialog box. You must set ShowDialog to 0 in the registry to keep the configuration dialog box from displaying.
Starting a trace in PowerScript with the PBTrace parameter
Instead of tracing all database commands from the start of a database connection, you can start and end a trace programmatically for specific database queries. To start a trace, you can assign the string value pair "PBTrace=1" to the transaction object DBParm property; to end a trace, you assign the string value pair "PBTrace=0". For example, if you wanted data to be logged to the trace output for a single retrieve command, you could disable tracing from the start of the connection and then surround the retrieve call with DBParm property assignments as follows:
SQLCA.DBMS = "TRACE ODBC"
dw_1.Retrieve ( )
If the database trace utility cannot open the trace output file with write access, an error message lets you know that the specified trace file could not be created or opened. If the trace utility driver cannot be loaded successfully, a message box informs you that the selected Trace DBMS is not supported in your current installation.