Trace DLL
The trace DLL traces input arguments, output arguments, deferred arguments,
return codes, and SQLSTATEs. When tracing is enabled, the Driver Manager calls
the trace DLL at two points: once upon function entry (before argument
validation) and again just before the function returns.
When an application calls a function, the Driver Manager calls a trace
function in the trace DLL before calling the function in the driver or processing the
call itself. Each ODBC function has a corresponding trace function (prefixed
with “TRACE”) that is identical to the ODBC function with the exception of the
name. When the trace function is called, the trace DLL captures the input
arguments and returns a return code. Because the trace DLL is called before the Driver
Manager validates arguments, invalid function calls are traced, so state
transition errors and invalid arguments are logged.
After calling the trace function in the trace DLL, the Driver Manager calls
the ODBC function in the driver. It then calls the TraceAfter macro in the trace DLL. This macro takes two arguments: the value returned by
the trace DLL for the trace function, and the return code returned by the
driver to the Driver Manager for the ODBC function (or the value returned by the
Driver Manager itself if it processed the function). The macro uses the value
returned for the trace function to manipulate captured input argument values. It
writes the code returned for the ODBC function to the log file (or displays it
dynamically, if that is enabled). It dereferences the output argument pointers,
and logs the output argument values.