fmwviormv / sqlite-net

Automatically exported from code.google.com/p/sqlite-net
0 stars 0 forks source link

LINQ Support for Contains #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

result = Items
    .Where((x) => x.Title.Contains(filter))
    .ToList();

x.Title is a string property and the query is supposed to perform an SQL LIKE 
operation.

What is the expected output? What do you see instead?

The application crashes with an SQLiteException: no such function: contains. 
Which is no surprise since the docs mention that functions are not supported. 
Still, having support with essential stuff like this would be nice.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by oli...@weichhold.com on 25 Nov 2011 at 10:38

GoogleCodeExporter commented 9 years ago
Are there any known workarounds? I've noticed that the LINQ provider contains 
at least some code related to Contains and Like but it does not seem to be 
working.

Original comment by oli...@weichhold.com on 26 Nov 2011 at 8:24

GoogleCodeExporter commented 9 years ago
I noticed that, too. Linq query like:

from i in db.Table<Adress>() where i.Name1.Contains(str) select i

or 

from i in db.Table<Adress>() where i.Name1.StartsWith(str) select i

are ending with "no such function: contains" or ".... StartsWith".

String operations are really important.

Original comment by m...@simetrix.de on 8 Jan 2012 at 2:27

GoogleCodeExporter commented 9 years ago
A possible workaround is that you get all objects out from SQLite-net and then 
use LINQ to Objects to perform the filtering. Performance lost is unavoidable, 
until the LINQ provider gets updated.

Original comment by lextu...@gmail.com on 3 Mar 2012 at 9:38