Project

General

Profile

« Previous | Next » 

Revision 3111

sql_io.py: put_table(): MissingCastException: When casting, handle InvalidValueException by filtering out invalid values with invalid2null() in a loop

View differences:

lib/sql_io.py
382 382
            
383 383
            log_debug('Casting '+strings.as_tt(out_col)+' input to '
384 384
                +strings.as_tt(type_))
385
            mapping[out_col] = cast_temp_col(db, type_, mapping[out_col],
386
                errors_table_)
385
            in_col = mapping[out_col]
386
            while True:
387
                try:
388
                    mapping[out_col] = cast_temp_col(db, type_, in_col,
389
                        errors_table_)
390
                    break # cast successful
391
                except sql.InvalidValueException, e:
392
                    log_exc(e)
393
                    
394
                    invalid2null(in_col, e.value, e)
387 395
        except sql.DuplicateKeyException, e:
388 396
            log_exc(e)
389 397
            

Also available in: Unified diff