<s> from trac . db . api import DatabaseManager <EOL> from trac . db_default import schema <EOL> def do_upgrade ( env , version , cursor ) : <EOL> """<STR_LIT>""" <EOL> if DatabaseManager ( env ) . connection_uri . startswith ( '<STR_LIT>' ) : <EOL> with env . db_transaction as db : <EOL> tabs = [ tab . name for tab in schema ] <EOL> cursor . execute ( """<STR_LIT>""" % '<STR_LIT:U+002C>' . join ( ( '<STR_LIT:%s>' , ) * len ( tabs ) ) , <EOL> [ db . schema ] + tabs ) <EOL> text_columns = { } <EOL> for tab , col in cursor : <EOL> text_columns . setdefault ( tab , [ ] ) . append ( col ) <EOL> for tab , cols in text_columns . iteritems ( ) : <EOL> mods = '<STR_LIT:U+002CU+0020>' . join ( '<STR_LIT>' % db . quote ( col ) <EOL> for col in cols ) <EOL> cursor . execute ( '<STR_LIT>' % ( db . quote ( tab ) , mods ) ) </s>
