Skip to content

Conversation

@mgrojo
Copy link
Member

@mgrojo 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.

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
Copy link
Member

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
Copy link
Member

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

@mgrojo
Copy link
Member 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
Copy link
Member

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

@mgrojo
Copy link
Member Author

mgrojo commented Aug 9, 2018

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

Of course.

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

Awesome, I'll merge this then 😄

@MKleusberg MKleusberg merged commit 4f1256c into master Aug 9, 2018
@MKleusberg MKleusberg deleted the pragma_case_sensitive_like branch August 9, 2018 12:00
@mgrojo mgrojo restored the pragma_case_sensitive_like branch October 14, 2023 21:27
@mgrojo mgrojo deleted the pragma_case_sensitive_like branch October 14, 2023 21:45
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