Revision 3689
Added by Aaron Marcuse-Kubitza over 12 years ago
map | ||
---|---|---|
158 | 158 |
row_ins_ct_ref = [0] |
159 | 159 |
if out_is_db: |
160 | 160 |
out_db = connect_db(out_db_config) |
161 |
rel_funcs = set(sql.tables(out_db, schema_like='%', |
|
162 |
table_like=r'\__%')) |
|
161 |
def is_rel_func(name): |
|
162 |
return (name in db_xml.put_special_funcs |
|
163 |
or sql.function_exists(out_db, sql_gen.Function(name))) |
|
163 | 164 |
|
164 | 165 |
doc = xml_dom.create_doc() |
165 | 166 |
root = doc.documentElement |
... | ... | |
342 | 343 |
sql.truncate(in_db, sql_io.errors_table(in_db, table)) |
343 | 344 |
|
344 | 345 |
# Strip XML functions not in the DB |
345 |
def is_rel_func(name): |
|
346 |
return (name in db_xml.put_special_funcs |
|
347 |
or sql.function_exists(in_db, sql_gen.Function(name))) |
|
348 | 346 |
xml_func.process(root, is_rel_func=is_rel_func) |
349 | 347 |
if debug: log_debug('Putting stripped:\n'+str(root)) |
350 | 348 |
# only calc if debug |
... | ... | |
432 | 430 |
pool.share_vars(locals()) |
433 | 431 |
|
434 | 432 |
row_root = root.cloneNode(True) # deep copy so don't modify root |
435 |
xml_func.process(row_root, on_error, lambda f: f in rel_funcs, |
|
436 |
out_db) |
|
433 |
xml_func.process(row_root, on_error, is_rel_func, out_db) |
|
437 | 434 |
if not xml_dom.is_empty(row_root): |
438 | 435 |
assert xml_dom.has_one_child(row_root) |
439 | 436 |
try: |
Also available in: Unified diff
bin/map: Fixed bug where needed to use sql.function_exists() to determine if something is a relational (now SQL) function, including in row-based mode, since that now uses sql_io.put_table(), which requires this. The bug fix relies on the new xml_func.process() feature that preserves unknown relational functions in case they are built-in functions rather than SQL functions.