Project

General

Profile

« Previous | Next » 

Revision 3522

sql_gen.py: Added Array and to_Array()

View differences:

lib/sql_gen.py
170 170
class Row(Tuple):
171 171
    def to_str(self, db): return 'ROW'+Tuple.to_str(self, db)
172 172

  
173
### Arrays
174

  
175
class Array(List):
176
    def __init__(self, values):
177
        values = map(remove_col_rename, values)
178
        
179
        List.__init__(self, values)
180
    
181
    def to_str(self, db): return 'ARRAY['+List.to_str(self, db)+']'
182

  
183
def to_Array(value):
184
    if isinstance(value, Array): return value
185
    return Array(lists.mk_seq(value))
186

  
173 187
##### Derived elements
174 188

  
175 189
src_self = object() # tells Col that it is its own source column

Also available in: Unified diff