This issue is part of #2454513: [meta] Make Drupal 8 work with SQLite.
The test case Drupal\taxonomy\Tests\TermTest is currently failing on SQLite.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2454733-followup-11.patch | 1.56 KB | amateescu |
| #10 | 2454733-followup.patch | 613 bytes | amateescu |
| #4 | 2454733.patch | 2.72 KB | amateescu |
Comments
Comment #1
amateescu commentedComment #2
bzrudi71 commented@amateescu, please see #1518506: Normalize how case sensitivity is handled across database engines before spending to much time trying to fix this. I spend an hour to fix this for PG before I found this issue ;-)
Comment #3
amateescu commentedThanks for the pointer, I was already following that issue :)
Comment #4
amateescu commentedThis was not very straightforward because the PDO
sqliteCreateCollation()method is not documented, yet it exists, it works just like it's non-PDO version (SQLite3::createCollation()) and we can use it :)Using PHP's built-in
strcasecmp()for the comparison function would probably be faster, but it doesn't support multi-byte strings so we have to implement our own mb-safe variant.Test run before:
After:
Comment #5
chx commentedWow. This doesn't murder performance?? I would've thought it does. But then again I guess SQLite won't be used with large datasets? This is truly a wow issue. The method was added to PHP 5.3 and 5.4 in https://bugs.php.net/bug.php?id=55226 so yes it's good to use.
However,
strcmp? That's a bit odd although I guess we can rely on that Unicode is created sanely , ie that A < B even if "A" and "B" are characters in a non Latin ABC.Also, I have added this function to the PHP manual so that the next guy will have an easier job.
Comment #6
webchickCommitted and pushed to 8.0.x. Thanks!
Comment #8
chx commentedThe documentation is now live at http://php.net/manual/en/pdo.sqlitecreatecollation.php . Thanks amateescu for showing it exists.
Comment #9
berdirShouldn't this use static::strtoupper(), because this just added a hardcoded dependency on the mbstring extension?
Comment #10
amateescu commentedI thought about that at some point but I think I got distracted by another issue and I forgot to correct it :/
Comment #11
amateescu commentedWhile we're there, let's also update its name to match that of the PHP function, like the other methods in the Unicode class. @amateescu--
Comment #12
chx commentedStill good. I was so shocked by the existence of the method and the testing time not exploding that I didn't catch this.
Comment #13
alexpottCommitted 2492b80 and pushed to 8.0.x. Thanks!