Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 7860:8b31893f5930
issue2551115/issue2551282 - utf8mb4 support in roundup
Fix issues with utf8 support in Roundup. By default using:
utf8mb4 charset
utf8mb4_unicode_ci collation (case insensitive)
utf8mb4_0900_ci collation (case sensitive)
which are settable from config.ini. Sadly I couldn't come up with a way
to mange these from one parameter. Doing a compatibility lookup table
would have increased the maintenance burden and have me chasing MySQL
changes. So I opted for the easy path and have the admins (with more
MySQL experience) make the choices.
Conversion directions added to upgrading.txt. I don't have any good
testing for this. I was able to generate utf8/utf8mb3 tables and load
a little data and convert. However this is a poor substitute for a
conversion on a working tracker 8-(.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 06 Apr 2024 22:47:25 -0400 |
| parents | 216662fbaaee |
| children | a9b136565838 |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Sat Apr 06 20:37:45 2024 -0400 +++ b/roundup/backends/rdbms_common.py Sat Apr 06 22:47:25 2024 -0400 @@ -1643,7 +1643,9 @@ case_insensitive_like = 'LIKE' # For some databases (mysql) the = operator for strings ignores case. - # We define the default here, can be changed in derivative class + # We define the default here, can be changed in derivative class. + # If set to any false value, self.get_case_sensitive_equal() is + # called to set its value. case_sensitive_equal = '=' # Some DBs order NULL values last. Set this variable in the backend @@ -1675,6 +1677,16 @@ """ self.do_journal = 0 + def get_case_sensitive_equal(self): + """ For some databases (mysql) the = operator for strings ignores + case. We define the default here, can be changed in derivative class. + + It takes config as an argument because mysql has multiple collations. + The admin sets both the primary and case sensitive collation in + config.ini for mysql. + """ + raise ValueError("get_case_sensitive_equal called in error") + # Editing nodes: def create(self, **propvalues): """ Create a new node of this class and return its id. @@ -2800,10 +2812,14 @@ # now add to the where clause w = [] + if not self.case_sensitive_equal: + self.case_sensitive_equal = \ + self.get_case_sensitive_equal() + cse = self.case_sensitive_equal for vv, ex in zip(v, exact): if ex: w.append("_%s._%s %s %s" % ( - pln, k, self.case_sensitive_equal, a)) + pln, k, cse, a)) args.append(vv) else: w.append("_%s._%s %s %s ESCAPE %s" % (
