Project

General

Profile

« Previous | Next » 

Revision 2809

bin/map: by_col: Pass on_error to db_xml.put_table() that calls ex_tracker.track()

View differences:

map
293 293
            
294 294
            return map_rows(get_value, util.WrapIter(wrap_row, rows), **kw_args)
295 295
        
296
        stdin = streams.LineCountStream(sys.stdin)
297
        def on_error(e):
298
            exc.add_msg(e, term.emph('input line #:')+' '+str(stdin.line_num))
299
            ex_tracker.track(e)
300
        
301 296
        if in_is_db:
297
            def on_error(e): ex_tracker.track(e)
298
            
302 299
            in_db = connect_db(in_db_config)
303 300
            
304 301
            # Get table and schema name
......
336 333
                # Import rows
337 334
                in_row_ct_ref = [0]
338 335
                db_xml.put_table(in_db, root.firstChild, table, commit,
339
                    in_row_ct_ref, row_ins_ct_ref, n, start)
336
                    in_row_ct_ref, row_ins_ct_ref, n, start, on_error)
340 337
                row_ct = in_row_ct_ref[0]
341 338
            else:
342 339
                # Use normal by-row method
......
345 342
            
346 343
            in_db.db.close()
347 344
        elif in_is_xml:
345
            stdin = streams.LineCountStream(sys.stdin)
346
            def on_error(e):
347
                exc.add_msg(e, term.emph('input line #:')+' '
348
                    +str(stdin.line_num))
349
                ex_tracker.track(e)
350
            
348 351
            def get_rows(doc2rows):
349 352
                return iters.flatten(itertools.imap(doc2rows,
350 353
                    xml_parse.docs_iter(stdin, on_error)))

Also available in: Unified diff