views:

29

answers:

1

I'm using System.Data.SQLite with NHibernate & Fluent NHibernate. I encountered some strange bug and I would like to log all queries executed on the SQLite database.

I already know about the ShowSQL NHibernate configuration option but I would like to log directly from SQLite. I found out about sqlite3_trace() but how to use it from .Net/NHibernate ?

In fact what I would like is a SQL profiler for SQLite.

Edit: I found the cause of the "strange" bug : after the schema was updated automatically by NHibernate DDL a SQL script was executed using ISession.CreateSQLQuery() witch dropped then recreated a table. No wonder the newly mapped properties where missing from that table. And those queries didn't appear in the logs...

+1  A: 

NHibernate Profiler works just fine. Here is a live demo of it working its magic. You can try it out for a full month before it expires, which should be more than enough for you to find that pesky little bugger. ;-)

Rafael Belliard
NHProf is an absolute godsend while working with NH.
Mike
Does it work for native queries (those executed using ISession.CreateSQLQuery()) ? I doubt that because I can't find those queries in HNibernate logs. I'll try to keep that 1 month trial for wen I really need it :D
Catalin DICU