Revision 2810
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
734 | 734 |
return dict(items) |
735 | 735 |
|
736 | 736 |
def mk_track_data_error(db, errors_table, cols, value, error_code, error): |
737 |
assert cols != () |
|
738 |
|
|
737 | 739 |
cols = map(sql_gen.to_name_only_col, cols) |
738 | 740 |
|
739 | 741 |
columns_cols = ['column'] |
... | ... | |
753 | 755 |
return mk_insert_select(db, errors_table, name_only_cols, |
754 | 756 |
mk_select(db, joins, select_cols, order_by=None)) |
755 | 757 |
|
756 |
def track_data_error(db, errors_table, *args, **kw_args): |
|
758 |
def track_data_error(db, errors_table, cols, *args, **kw_args):
|
|
757 | 759 |
''' |
758 | 760 |
@param errors_table If None, does nothing. |
759 | 761 |
''' |
760 |
if errors_table == None: return |
|
761 |
run_query(db, mk_track_data_error(db, errors_table, *args, **kw_args), |
|
762 |
if errors_table == None or cols == (): return
|
|
763 |
run_query(db, mk_track_data_error(db, errors_table, cols, *args, **kw_args),
|
|
762 | 764 |
cacheable=True, log_level=4) |
763 | 765 |
|
764 | 766 |
def cast(db, type_, col, errors_table=None): |
Also available in: Unified diff
sql.py: track_data_error(): Do nothing if cols are empty, because mk_track_data_error() requires at least one col. mk_track_data_error(): Assert that cols are not empty because VALUES clause requires at least one row.