How to remove "ESCAPE '~'" from WHERE statement?

How to remove "ESCAPE '~'" from WHERE statement?

Postby steffen_w » Tue 14 Apr 2015 10:57

Hi,

this happens on MySQL, not sure about other databases.

Problem: Instead of creating a WHERE statement like this: "WHERE SomeColumn LIKE '%~test123%'" the following statement is created: "WHERE SomeColumn LIKE '%~test123%' ESCAPE '~'".

Question: How do I get rid of that "ESCAPE '~'" thing? In dotConnect there seems to be a property called NoEscapeLike but I can't find that in LinqConnect.

LinqConnect version is 8.3.283.0
steffen_w
 
Posts: 16
Joined: Wed 06 Mar 2013 14:28

Re: How to remove "ESCAPE '~'" from WHERE statement?

Postby MariiaI » Wed 15 Apr 2015 09:18

Thank you for the report on this. We will investigate this issue more clearly and inform you about the results as soon as any are available.
As a temporary workaround, you could try using this code:
Code: Select all
var query = from c in ctx.DEPTs where SqlMethods.Like(c.LOC,"%~test123%") select c;

in this case the generated SQL query will look like this:
Code: Select all
SELECT t1.DEPTNO, t1.DNAME, t1.LOC
FROM test_m.DEPTs t1
WHERE t1.LOC LIKE :p0
-- p0: Input VarChar (Size = 10; DbType = AnsiString) [%~test123%]

Please tell us if this helps.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: How to remove "ESCAPE '~'" from WHERE statement?

Postby steffen_w » Wed 15 Apr 2015 14:55

Yes, thank you. That did work!

Before I used IndexOf, which allowed me to specify wether I wanted the LIKE search to be case sensitive or not. Meaning, I'd appreciate it very much if it'd be fixed in a way that would allow me to go back to using IndexOf.

Anyway, hope you have a great day :)
steffen_w
 
Posts: 16
Joined: Wed 06 Mar 2013 14:28

Re: How to remove "ESCAPE '~'" from WHERE statement?

Postby MariiaI » Tue 21 Apr 2015 09:36

"WHERE SomeColumn LIKE '%~test123%' ESCAPE '~'".
We have fixed this issue. The fix will be included in the next public build of LinqConnect.
We will post here when it is released.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: How to remove "ESCAPE '~'" from WHERE statement?

Postby MariiaI » Thu 23 Apr 2015 12:43

New build of LinqConnect 4.4.735 is available!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=31666.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)