Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case-insensitive string comparison #21

Closed
DanielSWolf opened this issue Aug 14, 2019 · 3 comments
Closed

Case-insensitive string comparison #21

DanielSWolf opened this issue Aug 14, 2019 · 3 comments

Comments

@DanielSWolf
Copy link

Many of the strings in our database contain non-Unicode characters. For the German market, these are primarily the Umlauts “ä”, “ö”, and “ü”, but we also have international customers with other common special characters. The problem is that by default, case-insensitive matching only works for ASCII characters (see this FAQ entry). So whenever we do case-insensitive string matching using like, we get false negatives for non-ASCII characters.

According the the FAQ entry, there is an “ICU” extension that fixes that, but that dramatically increases the library size (and, as discussed, would be very time-consuming to integrate).

As a quick fix, we've agreed to override the buit-in SQLite functions lower() and upper() so that they support the following fixed set of non-ASCII characters:

äàáâãåǎąăæāçćĉčđďðèéêëěęėēĝģğĥìíîïıīįĵķĺļłľñńňņöòóôõőøœŕřßśŝşšșťţþțüùúûűũųůūŵýÿŷźžż
ÄÀÁÂÃÅǍĄĂÆĀÇĆĈČĎĐĐÈÉÊËĚĘĖĒĜĢĞĤÌÍÎÏIĪĮĴĶĹĻŁĽÑŃŇŅÖÒÓÔÕŐØŒŔŘẞŚŜŞŠȘŤŢÞȚÜÙÚÛŰŨŲŮŪŴÝŸŶŹŽŻ

This allows us to perform querys like ... where upper(description) like upper(query).

@DanielSWolf
Copy link
Author

Internal ticket: https://yt.mobilexag.de/issue/PRDXMIP-921

Old ID: 19.4 (case-insensitive comparison)

@brodycj
Copy link
Collaborator

brodycj commented Aug 15, 2019

As a quick fix, we've agreed to override the buit-in SQLite functions lower() and upper()

FYI I had also raised storesafe/cordova-sqlite-evcore-extbuild-free#50 to track this "quick fix" enhancement.

This "quick fix" enhancement should now be done in merged PR #17.

I would like to discuss any further enhancements such as using the real ICU library, collation updates, and updates to built-in LIKE function (SQLite FAQ #18) in a new issue, if desired at some point.

At this point the browser platform does not have this feature done, as I have tracked in #27. Initial quick fix was raised here: brodycj/sqlite-evcustom-browser-memory-storage-ext-free#2. Will be part of long-term warranty/support/update plan (#24).

@DanielSWolf I would like to close this issue if you agree it is delivered OK for the other platforms (Android/iOS/Windows).

@brodycj
Copy link
Collaborator

brodycj commented Dec 19, 2019

Closing now.

The browser library still needs to be updated, to be tracked in #27.

I just raised #30 to track future consideration of using ICU for case-insensitive string comparison in a more "standard" way, as documented within sqlite.org.

@brodycj brodycj closed this as completed Dec 19, 2019
brodycj added a commit to brodycj/sqlite3-eu that referenced this issue Jun 10, 2022
to code & documentation

- add references for EU character mappings
  - mobilexag/cordova-sqlite-evplus-ext-free#21
  - storesafe/cordova-sqlite-evcore-extbuild-free#50 (comment)
- update documentation of known issue with SELECT LOWER_EU(9e999) &
  SELECT LOWER_EU(-9e999)
brodycj added a commit to brodycj/sqlite3-eu that referenced this issue Jun 10, 2022
to code & documentation

- add references for EU character mappings
  - mobilexag/cordova-sqlite-evplus-ext-free#21
  - storesafe/cordova-sqlite-evcore-extbuild-free#50 (comment)
- update documentation of known issue with SELECT LOWER_EU(9e999) &
  SELECT LOWER_EU(-9e999)
brodycj added a commit to brodycj/sqlite3-eu that referenced this issue Jun 10, 2022
to code & documentation

- add references for EU character mappings
  - mobilexag/cordova-sqlite-evplus-ext-free#21
  - storesafe/cordova-sqlite-evcore-extbuild-free#50 (comment)
- add reference to cordova-sqlite-storage test suite from:
  - https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
- update documentation of known issue with SELECT LOWER_EU(9e999) &
  SELECT LOWER_EU(-9e999)
brodycj added a commit to brodycj/sqlite3-eu that referenced this issue Jun 10, 2022
to code & documentation

- add references for EU character mappings
  - mobilexag/cordova-sqlite-evplus-ext-free#21
  - storesafe/cordova-sqlite-evcore-extbuild-free#50 (comment)
- add reference to cordova-sqlite-storage test suite from:
  - https://github.com/storesafe/cordova-sqlite-storage/tree/6.0.0/spec
- add reference to:
  - https://www.compart.com/en/unicode/U+0131
- test one-way U+0131 (`ı`) -> capital I
- update reproduction & documentation of known issue with
  U+0131 (`ı`) & capital I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants