Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 32

Show
Ignore:
Timestamp:
03/13/07 19:52:54
Author:
fumanchu
Message:

Allow _copy_column alias to be None. This is critical for tables whose qnames are already joins, since they don't get join-wrapped with an alias inside SelectWriter.__init__.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/select.py

    r31 r32  
    544544                # 'relation' is a single Table object. 
    545545                for a in self.attributes: 
    546                     self._copy_column(relation, relation.qname, a) 
     546                    self._copy_column(relation, None, a) 
    547547     
    548548    def _copy_column(self, table, alias, colkey): 
     549        """Copy the given column from the given table into our result table. 
     550         
     551        alias: the name that will be used for the given source table in the 
     552            FROM clause of the SQL SELECT statement. If None, this signifies 
     553            that the "SELECT columnlist FROM .." only references a single 
     554            table, in which case the column list will not use dotted column 
     555            names. 
     556        """ 
    549557        col = table[colkey] 
    550558        newcol = col.copy() 
     
    554562        newcol.initial = 1 
    555563         
    556         selname = '%s.%s' % (alias, col.qname) 
     564        if alias is None: 
     565            # Single table. 
     566            selname = col.qname 
     567        else: 
     568            selname = '%s.%s' % (alias, col.qname) 
    557569        if colkey in self.result: 
    558570            # Get the key for the table.