Modify ↓
Opened 11 years ago
Closed 11 years ago
#11310 closed defect (fixed)
MySQLConnector.to_sql() ignores utf8mb4 if a plugin or a db-upgrade call
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.6 |
Component: | database backend | Version: | 0.12-stable |
Severity: | normal | Keywords: | mysql utf8mb4 |
Cc: | Branch: | ||
Release Notes: |
Fix |
||
API Changes: | |||
Internal Changes: |
Description
Some plugins and db-upgrades call directly DatabaseManager(env).get_connector()
and IDatabaseConnector.to_sql()
to create tables. However, if the database is mysql with utf8mb4 charset, to_sql()
generates DDL for utf8 charset.
We should handle utf8m4 charset in this case.
$ ~/venv/trac/0.12.5/bin/python Python 2.4.3 (#1, Jan 9 2013, 06:49:54) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from trac.env import open_environment >>> from trac.db.api import DatabaseManager >>> from trac.db.schema import Table, Column >>> env = open_environment('/home/jun66j5/var/trac/0.12-mysql-utf8mb4') >>> connector, args = DatabaseManager(env).get_connector() >>> tab = Table('test', key='id')[Column('id'),] >>> list(connector.to_sql(tab)) ['CREATE TABLE test (\n `id` text,\n PRIMARY KEY (`id`(255))\n)']
Attachments (0)
Change History (2)
comment:1 by , 11 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in [12096] and merged in [12097-12098].
Note:
See TracTickets
for help on using tickets.
The proposal fix can be found in jomae.git@ticket11310. After the changes,
to_sql()
handles utf8mb4.