Project

General

Profile

« Previous | Next » 

Revision 2422

db_xml.py: put_table(): Added in_row_ct_ref param to store the # of input rows processed. Renamed row_ct_ref param to row_ins_ct_ref to distinguish it from new in_row_ct_ref param.

View differences:

lib/db_xml.py
128 128

  
129 129
input_col_prefix = '$'
130 130

  
131
def put_table(db, node, in_table, commit=False, row_ct_ref=None, limit=None,
132
    start=0, parent_ids_loc=None):
131
def put_table(db, node, in_table, commit=False, in_row_ct_ref=None,
132
    row_ins_ct_ref=None, limit=None, start=0, parent_ids_loc=None):
133 133
    '''
134 134
    @param node The XML tree that transforms the input to the output. Similar to
135 135
        put()'s node param, but with the input column name prefixed by
......
149 149
    def pkey(table): return sql.pkey(db, table, True)
150 150
    
151 151
    def put_table_(node, parent_ids_loc=None):
152
        return put_table(db, node, in_table, commit, row_ct_ref,
153
            parent_ids_loc=parent_ids_loc)
152
        return put_table(db, node, in_table, commit, in_row_ct_ref,
153
            row_ins_ct_ref, parent_ids_loc=parent_ids_loc)
154 154
    
155 155
    out_table = name_of(node)
156 156
    row = {}
......
191 191
    
192 192
    # Insert node
193 193
    db.log_debug('Putting columns: '+str(row))
194
    pkeys_loc = sql.put_table(db, out_table, in_tables, row, row_ct_ref)
194
    pkeys_loc = sql.put_table(db, out_table, in_tables, row, row_ins_ct_ref)
195 195
    if commit: db.db.commit()
196 196
    
197 197
    # Insert children with fkeys to parent
bin/map
308 308
                xml_func.strip(root)
309 309
                if debug: log_debug('Putting stripped:\n'+str(root))
310 310
                    # only calc if debug
311
                in_row_ct_ref = [0]
311 312
                db_xml.put_table(in_db, root.firstChild, table, commit,
312
                    row_ins_ct_ref, n, start)
313
                row_ct = 0 # unknown for now
313
                    in_row_ct_ref, row_ins_ct_ref, n, start)
314
                row_ct = in_row_ct_ref[0]
314 315
            else:
315 316
                # Use normal by-row method
316 317
                row_ct = map_table(col_names, sql.rows(cur), rows_start=start)

Also available in: Unified diff