Project

General

Profile

« Previous | Next » 

Revision 3026

sql_gen.py: NamedTable.to_str(): Put AS clause on same line as code being named if it didn't contain a newline, to avoid extra newlines

View differences:

lib/sql_gen.py
187 187
        self.cols = cols
188 188
    
189 189
    def to_str(self, db):
190
        str_ = self.code.to_str(db)+'\nAS '+Table.to_str(self, db)
190
        str_ = self.code.to_str(db)
191
        if str_.find('\n') >= 0: whitespace = '\n'
192
        else: whitespace = ' '
193
        str_ += whitespace+'AS '+Table.to_str(self, db)
191 194
        if self.cols != None:
192 195
            str_ += ' ('+(', '.join((c.to_str(db) for c in self.cols)))+')'
193 196
        return str_

Also available in: Unified diff