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

Allow "getting" and setting case_sensitive_like pragma #1494

Merged
merged 2 commits into from Aug 9, 2018

Conversation

Projects
None yet
3 participants
@mgrojo
Copy link
Contributor

mgrojo commented Aug 5, 2018

In order to allow case insensitive filtering, the pragma
case_sensitive_like is added to the GUI. Given that this pragma cannot be
read, a special SELECT request is made in DBBrowserDB::getPragma for
inferring its value.

See issue #1489.

I think this cannot give any problem, but just in case, I open this pull request with the implementation.

Allow "getting" and setting case_sensitive_like pragma
In order to allow case insensitive filtering, the pragma
case_sensitive_like is added to the GUI. Given that this pragma cannot be
read, a special SELECT request is made in DBBrowserDB::getPragma for
inferring its value.

See issue #1489.
@MKleusberg

This comment has been minimized.

Copy link
Member

MKleusberg commented Aug 8, 2018

Haha, that's pretty clever 😉 One caveat though: I think the reason why the PRAGMA is write-only is that there aren't just those two LIKE functions (case-sensitive and case-insensitive). Instead you can have any function as the LIKE operator by just registering it in the application or via an extension as described here. So I guess the PRAGMA sets the LIKE function to one of the two implementations that come with SQLite but because you can set it to an altogether different function from an extension it's not feasible to read from the PRAGMA. And with your approach we can't find out either if it's not a third function from some extension. So what do you reckon is better: just merging this anyway because it'll work most of the time or leave it out to avoid confusion here? I'm fine with either but when merging it we should add a comment in the code as well as a tooltip or something in the UI.

@justinclift

This comment has been minimized.

Copy link
Member

justinclift commented Aug 8, 2018

Hmmm, let's merge it and see how it goes in actual use? 😄

@mgrojo

This comment has been minimized.

Copy link
Contributor Author

mgrojo commented Aug 8, 2018

@MKleusberg You're probably right about why this pragma is write-only. Though it would make sense to implement a read interface returning ON, OFF, OTHER. The OTHER value would not be accepted in the write. But anyway, the pragma seems useful and I think we could add an information tooltip over the value: Warning: this pragma is not readable and this value has been inferred. Writing the pragma might overwrite a redefined LIKE provided by an SQLite extension.

The only way to have a redefined LIKE is by the user having loaded an extension through DB4S, isn't? In that case it would be possible to know in most cases whether that is a problem at all.

@MKleusberg

This comment has been minimized.

Copy link
Member

MKleusberg commented Aug 9, 2018

Yep, that warning sounds right. Want to add it and then merge this?

@mgrojo

This comment has been minimized.

Copy link
Contributor Author

mgrojo commented Aug 9, 2018

Yep, that warning sounds right. Want to add it and then merge this?

Of course.

Warning in the pragma case_sensitive_like
This pragma has some peculiarities, so it is convenient to warn the user
about it through a tool-tip in the value.
@MKleusberg

This comment has been minimized.

Copy link
Member

MKleusberg commented Aug 9, 2018

Awesome, I'll merge this then 😄

@MKleusberg MKleusberg merged commit 4f1256c into master Aug 9, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@MKleusberg MKleusberg deleted the pragma_case_sensitive_like branch Aug 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment