Edgewall Software

Ticket #3676: trac-mysql_backend.diff

File trac-mysql_backend.diff, 1.1 KB (added by Dirk Datzert <dummy@…>, 22 months ago)

My quick version of the fix

  • trac/db/mysql_backend.py

     
    5858        a max of 255 bytes per column. 
    5959        """ 
    6060        cols = [] 
    61         limit = 500 / len(columns) 
     61        limit = 333 / len(columns) 
    6262        if limit > 255: 
    6363            limit = 255 
    6464        for c in columns: 
    6565            name = '`%s`' % c 
    6666            table_col = filter((lambda x: x.name == c), table.columns) 
    6767            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 
    6976            # For non-text columns, we simply throw away the extra bytes. 
    7077            # That could certainly be optimized better, but for now let's KISS. 
    7178            cols.append(name)