I'm using the System.Data.SQLite and I'm trying to retrieve the SQL string that is generated by the query expression below. The query executes correctly, but the SQL string is SELECT NULL AS [EMPTY]
.
It seems that GetCommand().CommandText
is not supported, but if so, how else is it possible to access the generated SQL string?
[<Test>]
member this.showSQL() =
let connectionString = sprintf @"Data Source=%s;UTF8Encoding=True;Version=3" dbFilename
let connection = new SQLiteConnection(connectionString)
use dc = new DataContext(connection)
let channelMap = dc.GetTable<ChannelData>()
let map = query {
for row in channelMap do
where (row.ChannelId = 1)
select (row.ChannelId, row.Data0, row.State) }
let cmd = dc.GetCommand(map).CommandText;
printf "SQL: %s" cmd