New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string.StartsWith/EndsWith do not respect StringComparison arg. #2947
Comments
Will prepare fix for that. |
I believe the bug is here ExpressionBuilder.SqlBuilder.cs ISqlPredicate ConvertPredicate(IBuildContext? context, Expression expression)
{
...
switch (e.Method.Name)
{
case "Contains" : predicate = CreateStringPredicate(context, e, SqlPredicate.SearchString.SearchKind.Contains); break;
case "StartsWith" : predicate = CreateStringPredicate(context, e, SqlPredicate.SearchString.SearchKind.StartsWith); break;
case "EndsWith" : predicate = CreateStringPredicate(context, e, SqlPredicate.SearchString.SearchKind.EndsWith); break;
}
...
}
ISqlPredicate CreateStringPredicate(IBuildContext? context, MethodCallExpression expression, SqlPredicate.SearchString.SearchKind kind)
{
var e = expression;
var o = ConvertToSql(context, e.Object);
var a = ConvertToSql(context, e.Arguments[0]);
return new SqlPredicate.SearchString(o, false, a, kind, true); // !!!!!!!!!!! true means ignoreCase. linq2db always ignore case
} |
Don't worry I know all places which I have to fix. This is one of them. |
Looking at documentation, it is not. Where is Truth with Firebird? |
|
What is the better way to do non-case sensitive search? |
Well, FB doesnt have any special support for non-case sensitive search. So i'd use lower function. |
* Fix for #2947. Added support for case sensitive search. * merge * Fix for #2947. Added support for case sensitive search. * merge * Improved query caching support. * Added constant handling. * case-insensitive search * add more tests and fix implementations * to hell with oracle 12 collations Co-authored-by: MaceWindu <MaceWindu@users.noreply.github.com>
This bug hits atleast Firebird and Sqlite providers.
Also there is FB specific issue in FirebirdSqlOptimizer.ConvertSearchStringPredicate. "starting with" is case-sensitive, but linq2db use it in "ignorecase" branch
Environment details
linq2db version: 3.3
Database Server: Firebird
The text was updated successfully, but these errors were encountered: