Revision 2931
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1316 | 1316 |
try: |
1317 | 1317 |
cur = with_savepoint(db, main_insert) |
1318 | 1318 |
break # insert successful |
1319 |
except MissingCastException, e: |
|
1320 |
log_exc(e) |
|
1321 |
|
|
1322 |
out_col = e.col |
|
1323 |
type_ = e.type |
|
1324 |
|
|
1325 |
log_debug('Casting '+strings.as_tt(out_col)+' input to ' |
|
1326 |
+strings.as_tt(type_)) |
|
1327 |
def wrap_func(col): return cast(db, type_, col, errors_table_) |
|
1328 |
mapping[out_col] = sql_gen.wrap(wrap_func, mapping[out_col]) |
|
1319 | 1329 |
except DuplicateKeyException, e: |
1320 | 1330 |
log_exc(e) |
1321 | 1331 |
|
... | ... | |
1342 | 1352 |
for out_col, in_col in mapping.iteritems(): |
1343 | 1353 |
in_col = sql_gen.unwrap_func_call(in_col, func_name) |
1344 | 1354 |
invalid2null(in_col, value, e) |
1345 |
except MissingCastException, e: |
|
1346 |
log_exc(e) |
|
1347 |
|
|
1348 |
out_col = e.col |
|
1349 |
type_ = e.type |
|
1350 |
|
|
1351 |
log_debug('Casting '+strings.as_tt(out_col)+' input to ' |
|
1352 |
+strings.as_tt(type_)) |
|
1353 |
def wrap_func(col): return cast(db, type_, col, errors_table_) |
|
1354 |
mapping[out_col] = sql_gen.wrap(wrap_func, mapping[out_col]) |
|
1355 | 1355 |
except DatabaseErrors, e: |
1356 | 1356 |
log_exc(e) |
1357 | 1357 |
|
Also available in: Unified diff
sql.py: put_table(): Moved MissingCastException to the top of the exceptions list because it's more of a core exception than the others, and will be raised before any rows are even inserted