Project

General

Profile

« Previous | Next » 

Revision 3504

sql_io.py: data_exception_handler(): Refactored to use new sql_gen.ExcToWarning when not using an errors table

View differences:

lib/sql_io.py
56 56
            [[c.name] for c in srcs]), order_by=None)
57 57
        insert_query = sql.mk_insert_select(db, errors_table, errors_table_cols,
58 58
            sql_gen.Values(errors_table_cols).to_str(db))+';\n'
59
        handler += '''\
59
        handler = '''\
60 60
-- Save error in errors table.
61 61
DECLARE
62 62
    error_code text := SQLSTATE;
......
67 67
    row_var=errors_table_cols[0]).to_str(db))+'''
68 68
END;
69 69

  
70
'''
71
    else:
72
        handler += '''\
73
RAISE WARNING '%', SQLERRM;
74
'''
75
    handler += return_.to_str(db)
70
'''+return_.to_str(db)
71
    else: handler = sql_gen.ExcToWarning(return_)
76 72
    return sql_gen.ExcHandler('data_exception', handler)
77 73

  
78 74
def cast(db, type_, col, errors_table=None):

Also available in: Unified diff