tags:

views:

64

answers:

2

I've got this toy code, works fine, using MySQL

  var r = new SimpleRepository("DB", SimpleRepositoryOptions.None);
  var q = r.Find<User>(x => x.UserName ==  "testuser");

How do I view the SQL generated by that query ?

+1  A: 

For SQL Server, you can always run SQL Profiler to see the queries.

Arve
+1 Just what I was going to suggest - has the advantage that you're guaranteed to see what is sent to the server.
Bevan
Would be great, however as mentioned I do not use SQL server.
leeeroy
There's a previous question (http://stackoverflow.com/questions/124925/is-there-a-tool-like-microsofts-sql-server-profiler-for-mysql), about a MySQL equivalent for this tool. Unfortunately, the accepted answer was "No, there is no such tool."
Matthew Flaschen
So subsonic does not have a knob anywhere that lets it spew out the string it generates ? :-(
leeeroy
There is a Log property on the IDataProvider, but I can't figure out how to use it with the SimpleRepository. (And I don't know if it works either)
Arve
A: 

Unfortunately using SimpleRepository you can't do what you want without stepping into the SubSonic code. Because the Find method returns an IList it's executed before you get the chance to evaluate the SQL that's going to be executed. There are efforts underway to add this functionality in future versions of SubSonic but until then you're probably best looking at the MySQL Query Profiler.

Adam