Debugging and Reporting Environment Questions (FireDAC)
Go Up to FAQ (FireDAC)
This topic contains a list of questions and answers related to the debugging and reporting environment.
Q1: How can I obtain Client/Session info like FDExplorer?
A: See DBMS Environment Reports.
Q2: How can I generate trace/monitor output?
A: See Tracing and Monitoring.
Q3: How can I temporarily enable/disable trace/monitor output?
A: Use TFDMoniXxxxClientLink.Tracing. It enables or disables tracing output for a specific tracer kind. Also, to enable or disable trace output for a specific established connection, use FDConnection.ConnectionIntf.Tracing.
Q4: What is the meaning of EventKind?
A: Please see the list below:
- LiveCycle: Object creation/destruction. For example, IFDPhysConnection is created.
- Error: DBMS errors.
- ConnConnect: Connection open/close.
- ConnTransact: Start/Commit/Rollback.
- ConnService: Some special events.
- CmdPrepare: IFDPhysCommand.Prepare calls.
- CmdExecute: IFDPhysCommand.Execute or Open calls.
- CmdDataIn: Command parameter values.
- CmdDataOut: Result set rows.
- AdaptUpdat: All about posting updates.
- Vendor: The low-level DBMS API calls.
- Component: Some high-level events.
Q5: In which unit and in which part of the code can I view the SQL statement if I need to do some debugging?
A: You can do that using one of the following options:
- You can use MonitorBy connection parameter.
- Open FireDAC.Phys.pas, find the TFDPhysCommand.Prepare method and there is the InternalPrepare method call. Set a breakpoint there and check the value of the FDbCommandText field. It is the SQL command text, as it will be sent to a DBMS.
Q6: How can I get the final SQL statement with all the parameters and macros replaced?
A: See TFDQuery.Text. Note that FireDAC does not substitute parameter values into the final SQL command text.
Q7: I enabled trace output and I am getting constant Access Violations. What is wrong? Is it a bug?
A: FireDAC for the ODBC based drivers uses the Microsoft ODBC driver manager tracing facilities. To generate the trace output, the manager internally uses C RTL functions IsBadReadPtr/IsBadWritePtr, which can generate a controlled AV internally. The exception will not be propagated outside the manager, but the IDE debugger stops on it. Just ignore them.