Answer the question
In order to leave comments, you need to log in
How to properly configure sqlite so that LIKE works in Cyrillic?
Hello. Tell me, please, how to set it up correctly so that LIKE works in Cyrillic?
I am using sqlite3 in express.js project
CREATE TABLE people (
pbnum INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
pbfirstName VARCHAR(50) NOT NULL,
pblastName VARCHAR(50) NOT NULL,
pbcity VARCHAR(50) NOT NULL,
pbphoneNumber VARCHAR(50) NOT NULL);
INSERT INTO people (pbfirstName, pblastName, pbcity, pbphoneNumber) VALUES
('user', 'one', 'Сочи', '+7 (111) 111-11-11'),
('user', 'two', 'Москва', '+7 (222) 222-22-22'),
('user', 'three', 'Москва', '+7 (333) 333-33-33'),
('user', 'four', 'Москва', '+7 (444) 444-44-44'),
('user', 'five', 'Москва', '+7 (555) 555-55-55');
SELECT * FROM people WHERE CONCAT (pbfirstName, pblastName, pbcity) LIKE "%со%"
Answer the question
In order to leave comments, you need to log in
It did not work due to the fact that the ssl certificate was not connected.
Check $txt - everything that goes into $api (for a link) should already be in the URL
To check, try entering "%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82" instead of "$txt"
Or drop the full $api link for an example.
This is a well-known bug feature of sqlite. Do like this:
Cast both parts to the same case, then LIKE works. And since you still have a wildcard on both sides, you can still forget about using indexes, so it doesn’t change anything.
If the wildcard was only on one side, it would be possible to create a functional index
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question