Skip to content
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

Add Contains method with StringComparison parameter. #806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

animha
Copy link

@animha animha commented Feb 11, 2019

When writing a TableQuery using "Contains" method, you always have a case-sensitive result, even if everything should work in a case-insensitive way.
This is due to the way the SELECT is constructed by the TableQuery class (now "instr" sqlite function is used, resulting always in a case-sensitive result).

I added an extension to Contains method, allowing developer to indicate which StringComparison option to use (like StartsWith/EndsWith method). If a case-insensitive option is specified, the sql code is constructed with LIKE instead of instr().

Managed to construct query with LIKE instead of instr() function for case-insensitive Contains.
@awaescher
Copy link

Waiting for this 🥰

Copy link
Owner

@praeclarum praeclarum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I just want to get rid of the extra file. Please move your extension method into SQLite.cs. Thanks!

/// <summary>
/// Class for Contains extension with StringComparison option
/// </summary>
public static class StringContainsExtension
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename to SQLiteStringExtensions and move it into the file SQLite.cs. Please delete this file.

@FroggieFrog
Copy link

Is there any chance that this feature will be added?
Is the extension method necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants