Tell us your opinion: what SQL should be generated for MySQL by String.Equals(stringExpression1, stringExpression2, stringComparisonValue) for different values of
StringComparison?
We consider the most flexible way to do this with SQL-construction like
Code: Select all
stringExpression1 = stringExpression2 COLLATE x
where x is latin1_bin or utf16_bin or utf8_bin or any other collation.
So the Collate(string value, string collationName) method of the SqlMethods class is implemented in the new (7.8) version of dotConnect for MySQL.
An example of its usage:
Code: Select all
var a = context.Depts.FirstOrDefault<Dept>(w => w.DEPTNO == myDEPTNO && SqlMethods.Collate(w.DNAME.Trim(), "utf8_bin") == research.ToString().Trim());
The corresponding SQL would be:
Code: Select all
SELECT t1.DEPTNO, t1.DNAME, t1.LOC
FROM alexsh.Dept t1
WHERE (t1.DEPTNO = :p0) AND (TRIM(t1.DNAME) COLLATE 'utf8_bin' = :p1) LIMIT 1
-- p0: Input Int (Size = 0; DbType = Int32) [10]
-- p1: Input VarChar (Size = 8; DbType = AnsiString) [RESEARCH]