Revision 2735
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1127 | 1127 |
# Create input joins from list of input tables |
1128 | 1128 |
in_tables_ = in_tables[:] # don't modify input! |
1129 | 1129 |
in_tables0 = in_tables_.pop(0) # first table is separate |
1130 |
errors_table_ = errors_table(db, in_tables0) |
|
1130 | 1131 |
in_pkey = pkey(db, in_tables0, recover=True) |
1131 | 1132 |
in_pkey_col = sql_gen.as_Col(in_pkey, in_tables0) |
1132 | 1133 |
input_joins = [in_tables0]+[sql_gen.Join(v, |
... | ... | |
1189 | 1190 |
log_debug('Caught exception: '+e_str) |
1190 | 1191 |
assert e_str not in exc_strs # avoid infinite loops |
1191 | 1192 |
exc_strs.add(e_str) |
1193 |
|
|
1192 | 1194 |
def remove_all_rows(): |
1193 | 1195 |
log_debug('Returning NULL for all rows') |
1194 | 1196 |
limit_ref[0] = 0 # just create an empty pkeys table |
1197 |
|
|
1195 | 1198 |
def ignore(in_col, value): |
1196 | 1199 |
in_col_str = strings.as_tt(repr(in_col)) |
1197 | 1200 |
db.log_debug('Adding index on '+in_col_str+' to enable fast filtering', |
1198 | 1201 |
level=2.5) |
1199 | 1202 |
add_index(db, in_col) |
1203 |
|
|
1200 | 1204 |
log_debug('Ignoring rows with '+in_col_str+' = ' |
1201 | 1205 |
+strings.as_tt(repr(value))) |
1202 | 1206 |
def remove_rows(in_col, value): |
... | ... | |
1274 | 1278 |
|
1275 | 1279 |
log_debug('Casting '+strings.as_tt(out_col)+' input to ' |
1276 | 1280 |
+strings.as_tt(type_)) |
1277 |
def wrap_func(col): |
|
1278 |
return cast(db, type_, col, errors_table(db, in_tables0)) |
|
1281 |
def wrap_func(col): return cast(db, type_, col, errors_table_) |
|
1279 | 1282 |
mapping[out_col] = sql_gen.wrap(wrap_func, mapping[out_col]) |
1280 | 1283 |
except DatabaseErrors, e: |
1281 | 1284 |
log_exc(e) |
Also available in: Unified diff
sql.py: put_table(): Factored out errors_table name setting so it can be used by ignore()