Answer the question
In order to leave comments, you need to log in
SQLite refuses to work with lower() on Windows-1251
Habr, help, the deadline is coming, but the delivery of the project is not.
There was a problem - lower() does not work in sql queries to the SQLite database on the hosting.
Request:
... WHERE lower(Name) LIKE lower('$startWith%')
Answer the question
In order to leave comments, you need to log in
Not very familiar with SQLite. Try to convert strings to uppercase when comparing strings, i.e. UPPER.
From the official docs:
>lower(X) The lower(X) function returns a copy of string X with all ASCII characters converted to lower case. The default built-in lower() function works for ASCII characters only. To do case conversions on non-ASCII characters, load the ICU extension.
The windows-1251 encoding is not quite normal ASCII, probably from here all the troubles. Read more here www.sqlite.org/fts3.html A
lot of people
face a similar problem when searching for strings in UTF in SQLite, you can google for this case.
For php:
$db = new SQLite3('1406-2280.sqlite');
function php_nocase($string) {
return strtolower($string);
}
$db->createFunction('php_nocase', 'php_nocase');
$sql = '
SELECT *
FROM NAME_AND_RUB as nr
WHERE php_nocase(nr.name) LIKE php_nocase("%горь%")
';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question