Ticket #3676: trac-mysql_backend.diff
| File trac-mysql_backend.diff, 1.1 KB (added by Dirk Datzert <dummy@…>, 22 months ago) |
|---|
-
trac/db/mysql_backend.py
58 58 a max of 255 bytes per column. 59 59 """ 60 60 cols = [] 61 limit = 500/ len(columns)61 limit = 333 / len(columns) 62 62 if limit > 255: 63 63 limit = 255 64 64 for c in columns: 65 65 name = '`%s`' % c 66 66 table_col = filter((lambda x: x.name == c), table.columns) 67 67 if len(table_col) == 1 and table_col[0].type.lower() == 'text': 68 name += '(%s)' % limit 68 if name == '`rev`': 69 name += '(%s)' % 20 70 elif name == '`path`': 71 name += '(%s)' % 255 72 elif name == '`change_type`': 73 name += '(%s)' % 2 74 else: 75 name += '(%s)' % limit 69 76 # For non-text columns, we simply throw away the extra bytes. 70 77 # That could certainly be optimized better, but for now let's KISS. 71 78 cols.append(name)
