Revision 344
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import os.path |
7 | 7 |
import sys |
8 |
import traceback |
|
9 | 8 |
import xml.dom.minidom as minidom |
10 | 9 |
|
11 | 10 |
sys.path.append(os.path.dirname(__file__)+"/../lib") |
12 | 11 |
|
12 |
import exc |
|
13 | 13 |
import opts |
14 | 14 |
import Parser |
15 | 15 |
import sql |
... | ... | |
161 | 161 |
row_ct_ref = [0] |
162 | 162 |
def process_row(): |
163 | 163 |
try: xml_func.process(root) |
164 |
except xml_func.SyntaxException: traceback.print_exc()
|
|
164 |
except xml_func.SyntaxException, e: exc.print_ex(e, False)
|
|
165 | 165 |
else: |
166 | 166 |
assert xml_dom.has_one_child(root) |
167 | 167 |
child = root.firstChild |
168 | 168 |
try: |
169 | 169 |
db_xml.put(out_db, child, False, row_ct_ref, out_pkeys) |
170 | 170 |
if commit: out_db.commit() |
171 |
except DatabaseError: |
|
172 |
out_db.rollback() |
|
173 |
traceback.print_exc() |
|
171 |
except sql.DatabaseErrors, e: exc.print_ex(e) |
|
172 |
out_db.rollback() # clean up for next row |
|
174 | 173 |
root.clear() |
175 | 174 |
process_input(root, process_row) |
176 | 175 |
print 'Inserted '+str(row_ct_ref[0])+' rows' |
Also available in: Unified diff
bin/map: Print DatabaseErrors without stack traces