3 ms·
The docs for the pragma are confusing me about whether or not GLOB's behavior is also affected: > This pragma uses sqlite3_create_function() to overload the LI
by spiffytech 3y ago
The docs for the pragma are confusing me about whether or not GLOB's behavior is also affected:
> This pragma uses sqlite3_create_function() to overload the LIKE and GLOB functions, which may override previous implementations of LIKE and GLOB registered by the application. This pragma only changes the behavior of the SQL LIKE operator. It does not change the behavior of the sqlite3_strlike() C-language interface, which is always case insensitive.
You're right though, GLOB defaults to being case-sensitive!
> GLOB is case sensitive, unlike LIKE.
- masklinn 3y agoIndeed the docs are very confusing but I think what it's saying is it uses sqlite3_create_function to replace the "default" implementation of LIKE (which calls the like function: https://www.sqlite.org/lang_corefunc.html#like https://www.sqlite.org/lang_corefunc.html#like). It might be mentioning GLOB because it also resets its function (to the default https://www.sqlite.org/lang_corefunc.html#glob https://www.sqlite.org/lang_corefunc.html#glob) so a client which installed its own glob() function would get an odd behaviour. I can't say I understand why it resets glob though. From looking at archive.org, until 2011 the doc said: > This pragma only works if the built-in like() SQL function has not been overloaded using sqlite3_create_function(). then in mid 2011 it changes to > This pragma uses sqlite3_create_function() to overload the LIKE and GLOB functions, which may override previous implementations of LIKE and GLOB registered by the application. but the only changelog entry about case_sensitive_like before then was its introduction back in 2005. 3.0.6 beta (september 2004) does indicate > Combine the implementations of LIKE and GLOB into a single pattern-matching subroutine. but the link still seems debatable, surely overriding glob() does not normally change the behaviour of like(), it's only the default impls which are shared? Anyway if someone wants to code-dive sqlite, that's an open question.