SQLite sql generation issue?
See original GitHub issueI have this query
_dataConnection.GetTable<TEntity>().Single(x => x.MyColumn == "xYz")
which generates a wrong sql
-- SQLite.Classic SQLite
DECLARE @take -- Int32
SET @take = 2
SELECT
[x].[Id],
[x].[MyColumn]
FROM
[TableName] [x]
WHERE
[x].[MyColumn] = 'xYz'
LIMIT @take
Exception message: Sequence contains no elements Exception thrown: ‘System.InvalidOperationException’ in System.Linq.dll Exception thrown: ‘System.InvalidOperationException’ in System.Private.CoreLib.dll
Environment details
linq2db version: 3.1.6 Database Provider: SQLite Operating system: Windows 10 Pro for Workstations .NET Framework: .NET Core 3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
CG/SQL: Easy, accurate code generation for SQLite
The generated code always checks the various return codes and always uses the correct column ordinals and column types when binding or reading ......
Read more >objective c - sqlite db creation issue
Im running a method which checks if DB exists, if not, it creates the db. Ive found several examples where different paths are...
Read more >Result and Error Codes
The SQLITE_OK result code means that the operation was successful and that there were no errors. Most other result codes indicate an error....
Read more >The Next-Generation Query Planner
The QPSG means that if all of your queries run efficiently during testing, and if your application does not change the schema, then...
Read more >Frequently Asked Questions
Unless opened with flags to prevent it, a SQLite database is created if it does not already exist. Newly created databases are initially...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you need case-sensitive comparison, you can define custom comparison function:
or BINARY instead of RTRIM (sqlite doesn’t have a lot of collations: https://www.sqlite.org/datatype3.html#collation)
Yeah it seems so, this works: https://github.com/Lombiq/Helpful-Libraries/blob/eb957f470d313e5e1b735e67ecaf6943976dca5e/Lombiq.HelpfulLibraries.LinqToDb/LinqToDbQueryExecutor.cs#L54