Search code examples
firebirdibexpert

Is there a detailed debug feature in Firebird?


I wanted to debug an execution of a procedure. Behind this procedure there are several triggers and transactions. There is one dataset which is updated within this procedure which behaves different than all the other datasets. So I wanted to debug detailed.

I already tried to debug with the normal procedure debugger, but that just debugs on surface, so it debugs only this procedure and does not jump into all tables / procedures / triggers which are included in this execution.

I also tried to use the trace and audit feature, but this is too confusing and it shows me too many information I don't need.

Basically I need to know if there is a possibility to debug detailed like in other IDEs e.g Eclipse.


Solution

  • This is probably not the answer you are looking for but is has worked for me in the past.

    What I've done in place of debugging to capture run time statistics and flow is the following.

    In Firebird 2.5 you have autonomous transactions. I have a stored procedure that takes in a context description, and message. Inside the SP I insert the context and message and a timestamp into a Firebird table deemed for logging. I wrap that insert statement inside a "IN AUTONOMOUS TRANSACTION". This transaction will commit that transaction immediately and will allow me to see the rows in that table as the procedure is executing.

    You can capture elapsed times or other statistics. The downside to doing it this way is that you will need to update the stored procedures and triggers that you want information from, so in a production system this might not be allowed.