Project

General

Profile

« Previous | Next » 

Revision 2358

sql.py: put_table(): Renamed log_ignore() to ignore() and factored common conds-modifying code into it

View differences:

lib/sql.py
780 780
    
781 781
    def log_exc(e):
782 782
        db.log_debug('Caught exception: '+exc.str_(e, first_line_only=True))
783
    def log_ignore(in_col, value):
783
    def ignore(in_col, value):
784 784
        db.log_debug('Ignoring rows with '+str(in_col)+' = '+value)
785
        conds[in_col] = sql_gen.CompareCond(value, '!=')
785 786
    
786 787
    # Do inserts and selects
787 788
    join_cols = {}
......
812 813
            join_cols.update(util.dict_subset(mapping, e.cols))
813 814
            db.log_debug('Ignoring existing rows, comparing on '+str(join_cols))
814 815
            assert join_cols != old_join_cols # avoid infinite loops
815
            
816
            # rerun loop with additional constraints
817 816
        except NullValueException, e:
818 817
            log_exc(e)
819 818
            
......
822 821
            except KeyError:
823 822
                db.log_debug('Missing mapping for NOT NULL '+out_col)
824 823
                limit = 0 # just create an empty pkeys table
825
            else:
826
                log_ignore(in_col, 'NULL')
827
                conds[in_col] = sql_gen.CompareCond(None, '!=')
828
            
829
            # rerun loop with additional constraints
824
            else: ignore(in_col, 'NULL')
830 825
        except FunctionValueException, e:
831 826
            log_exc(e)
832 827
            
833 828
            assert e.name == out_table.name
834 829
            out_col = 'value' # assume function param was named "value"
835
            in_col = mapping[out_col]
836
            value = e.value
837
            log_ignore(in_col, value)
838
            conds[in_col] = sql_gen.CompareCond(value, '!=')
839
            
840
            # rerun loop with additional constraints
830
            ignore(mapping[out_col], e.value)
831
        # after exception handled, rerun loop with additional constraints
841 832
    
842 833
    if row_ct_ref != None and cur.rowcount >= 0:
843 834
        row_ct_ref[0] += cur.rowcount

Also available in: Unified diff