Maksee
Maksee

Reputation: 2401

Convenient way to use LIKE case sensivity in sqlite

As I see LIKE operator can optimize query if I switch PRAGMA case_sensitive_like=ON. I measured, it really worked, queries "LIKE someth%" becomes ten times faster on a compartively large binary indexed tables. But the problem is that my library implemented as an add-on to my application, it maintains its own tables with any db it is connected. So the problems are

Upvotes: 2

Views: 554

Answers (1)

Nick Dandoulakis
Nick Dandoulakis

Reputation: 43130

I can not read case_sensitive_like since it is only supported to be set, not read. So I can not temporarily read the state and return it after the query

You can get the state of case_sensitive_like with a query like this one:

select case when 'a' like 'A' then 0 else 1 end

which will return 1 if case_sensitive_like = ON and 0 if it's OFF.

Upvotes: 6

Related Questions