Project

General

Profile

« Previous | Next » 

Revision 2409

sql.py: put_table(): Add index on columns with invalid values to enable fast filtering

View differences:

lib/sql.py
881 881
    
882 882
    def log_exc(e):
883 883
        db.log_debug('Caught exception: '+exc.str_(e, first_line_only=True))
884
    def log_ignore(in_col, value):
885
        db.log_debug('Ignoring rows with '+str(in_col)+' = '+repr(value))
884
    def ignore(in_col, value):
885
        in_col_str = str(in_col)
886
        db.log_debug('Adding index on '+in_col_str+' to enable fast filtering')
887
        index_col(db, in_col)
888
        db.log_debug('Ignoring rows with '+in_col_str+' = '+repr(value))
886 889
    def remove_rows(in_col, value):
887
        log_ignore(in_col, value)
890
        ignore(in_col, value)
888 891
        cond = (in_col, sql_gen.CompareCond(value, '!='))
889 892
        assert cond not in conds # avoid infinite loops
890 893
        conds.add(cond)
891 894
    def invalid2null(in_col, value):
892
        log_ignore(in_col, value)
895
        ignore(in_col, value)
893 896
        update(db, in_table, [(in_col, None)],
894 897
            sql_gen.ColValueCond(in_col, value))
895 898
    

Also available in: Unified diff