Revision 2432
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/db_xml.py | ||
---|---|---|
154 | 154 |
parent_ids_loc=parent_ids_loc) |
155 | 155 |
|
156 | 156 |
out_table = name_of(node) |
157 |
|
|
158 |
# Divide children into fields and children with fkeys to parent |
|
157 | 159 |
row = {} |
158 | 160 |
children = [] |
159 |
|
|
160 |
# Divide children into fields and children with fkeys to parent |
|
161 | 161 |
for child in xml_dom.NodeElemIter(node): |
162 | 162 |
child_name = name_of(child) |
163 | 163 |
if xml_dom.is_empty(child): row[child_name] = None |
... | ... | |
166 | 166 |
else: |
167 | 167 |
child_value = xml_dom.value_node(child) |
168 | 168 |
if is_ptr(child_name) or xml_func.is_func(child_value): |
169 |
row[child_name] = put_table_(child_value)
|
|
169 |
row[child_name] = child_value
|
|
170 | 170 |
else: children.append(child) |
171 | 171 |
try: del row[pkey(out_table)] |
172 | 172 |
except KeyError: pass |
... | ... | |
180 | 180 |
# Divide fields into input columns and literal values |
181 | 181 |
in_tables = [in_table] |
182 | 182 |
for out_col, value in row.iteritems(): |
183 |
# Handle forward pointers |
|
184 |
if xml_dom.is_node(value): row[out_col] = value = put_table_(value) |
|
185 |
|
|
186 |
# Translate values |
|
183 | 187 |
if isinstance(value, sql_gen.Col): # value is temp table column |
184 | 188 |
in_tables.append(value.table) |
185 | 189 |
elif util.is_str(value) and value.startswith(input_col_prefix): |
Also available in: Unified diff
db_xml.py: put_table(): Handle forward pointers in translation-to-sql_gen step instead of in XML-tree-parsing step, so that special handling for structural XML functions can use the parsed tree before any sql.put_table() processing takes place