LinqConnect Professional Version 4.4.393 (12-Dec-2013) - Incorrect query for SQLite
Posted: Wed 25 Dec 2013 10:25
Using a navigational property in .Count() expression results in an invalid query (SQLite)
-----------------------------------------------------------------------------------------
When the following expression is executed:
q.Count(foo => foo.Bar.Baz == baz)
The corresponding SQL query is generated invalid:
The query returns an error "no such column: Baz". Actually the "Baz" column doesn't belong to the "Foo" table, but it rather belongs to the "Bar" table. The correct query would be:
Please see the sample project where the issue is apparent.
SqliteTest.7z (10.0 КБ) http://rghost.ru/51195684
-----------------------------------------------------------------------------------------
When the following expression is executed:
q.Count(foo => foo.Bar.Baz == baz)
The corresponding SQL query is generated invalid:
Code: Select all
SELECT COUNT(*) AS C1
FROM Foos t1
WHERE (Baz = 'Lorem') AND datetime(t1.DT) > datetime('2013-12-25 13:00:00')
Code: Select all
SELECT COUNT(*) AS C1
FROM Foos t1
INNER JOIN Bars t2 ON t1.BarId = t2.BarId
WHERE (t2.Baz = 'Lorem') AND datetime(t1.DT) > datetime('2013-12-25 13:00:00')
SqliteTest.7z (10.0 КБ) http://rghost.ru/51195684