Skip to content

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?

Joy-less added a commit to Joy-less/SQLiteSharp that referenced this pull request Dec 2, 2024
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