Revision 3360
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_io.py | ||
---|---|---|
38 | 38 |
def cast(db, type_, col, errors_table=None): |
39 | 39 |
'''Casts an (unrenamed) column or value. |
40 | 40 |
If errors_table set and col has srcs, saves errors in errors_table (using |
41 |
col's srcs attr as the source columns) and converts errors to warnings.
|
|
41 |
col's srcs attr as source columns). Otherwise, converts errors to warnings.
|
|
42 | 42 |
@param col str|sql_gen.Col|sql_gen.Literal |
43 | 43 |
@param errors_table None|sql_gen.Table|str |
44 | 44 |
''' |
... | ... | |
101 | 101 |
END; |
102 | 102 |
END LOOP; |
103 | 103 |
END; |
104 |
|
|
105 | 104 |
''' |
105 |
else: |
|
106 |
query += '''\ |
|
107 |
RAISE WARNING '%', SQLERRM; |
|
108 |
''' |
|
106 | 109 |
query += '''\ |
107 |
RAISE WARNING '%', SQLERRM; |
|
108 | 110 |
RETURN NULL; |
109 | 111 |
END; |
110 | 112 |
$$; |
Also available in: Unified diff
sql_io.py: cast(): Don't output warnings for errors that are stored in the errors table, because this clutters the log output unnecessarily. Warnings are still output when there is no errors table.