in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Where to get the created SQL statement ?

Last post 02-27-2010 7:51 AM by ion123. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-13-2009 7:16 AM

    Where to get the created SQL statement ?

    Hello,

    I would like where can i get the SQL statement sent to the SQLITE engine ?

    I tried the ToTraceString() method but it always returns me the same select statement !

    Thank you

  • 02-27-2010 7:51 AM In reply to

    Re: Where to get the created SQL statement ?

    Hi,

    You should be able to get the sql command with (query as ObjectQuery).ToTraceString(); [where query is a IQueryable]

    Example:

    var query = from o in context.Item select o; 

    (query as ObjectQuery).ToTraceString() => "SELECT \r\n[Extent1].[ItemId] AS [ItemId]], \r\n[Extent1].[ItemName] AS [ItemName]\r\nFROM [Item] AS [Extent1]"

    When you want the queries generated by

    context.SaveChanges();

    You should take a look @ sqlite3_trace (http://www.sqlite.org/c3ref/profile.html).

    ( Attached a patch to use sqlite3_trace() }

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems