Project

General

Profile

« Previous | Next » 

Revision 2052

db_xml.py: put_table(): Take separate in_table and in_schema names, instead of in_table and table_is_esc, because the in_schema is needed to scope the temp tables appropriately

View differences:

lib/db_xml.py
124 124
    
125 125
    def __str__(self): return self.name
126 126

  
127
def put_table(db, node, in_table, commit=False, row_ct_ref=None,
128
    table_is_esc=False):
127
def put_table(db, node, in_table, in_schema=None, commit=False,
128
    row_ct_ref=None):
129 129
    '''
130 130
    @param node The XML tree that transforms the input to the output. Similar to
131 131
        put()'s node param, but with the input column name prefixed by "$" in
132 132
        place of the column value.
133 133
    @param commit Whether to commit after each query
134 134
    '''
135
    def qual_name(table): sql.qual_name(db, in_schema, table)
136
    
135 137
    def pkey(table): return sql.pkey(db, table, True)
136 138
    
137 139
    out_table = name_of(node)
bin/map
295 295
                    schema = None
296 296
            table_is_esc = False
297 297
            if schema != None:
298
                table = sql.qual_name(in_db, schema, table)
298
                qual_table = sql.qual_name(in_db, schema, table)
299 299
                table_is_esc = True
300
            else: qual_table = table
300 301
            
301 302
            # Fetch rows
302 303
            if by_col: limit = 0 # only fetch column names
303 304
            else: limit = n
304
            cur = sql.select(in_db, table, limit=limit, start=start,
305
            cur = sql.select(in_db, qual_table, limit=limit, start=start,
305 306
                cacheable=False, table_is_esc=table_is_esc)
306 307
            col_names = list(sql.col_names(cur))
307 308
            
308 309
            if by_col:
309 310
                map_table(col_names, []) # just create the template
310 311
                xml_func.strip(root)
311
                db_xml.put_table(in_db, root.firstChild, table, commit,
312
                    row_ins_ct_ref, table_is_esc)
312
                db_xml.put_table(in_db, root.firstChild, table, schema, commit,
313
                    row_ins_ct_ref)
313 314
            else:
314 315
                # Use normal by-row method
315 316
                row_ct = map_table(col_names, sql.rows(cur), rows_start=start)

Also available in: Unified diff