Revision 1849
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
242 | 242 |
limit=end, start=0) |
243 | 243 |
row_ct = map_table(list(sql.col_names(cur)), sql.rows(cur)) |
244 | 244 |
|
245 |
in_db.close() |
|
245 |
in_db.db.close()
|
|
246 | 246 |
elif in_is_xml: |
247 | 247 |
def get_rows(doc2rows): |
248 | 248 |
return iters.flatten(itertools.imap(doc2rows, |
... | ... | |
307 | 307 |
sql.with_savepoint(out_db, |
308 | 308 |
lambda: db_xml.put(out_db, root.firstChild, |
309 | 309 |
out_pkeys, row_ins_ct_ref, on_error)) |
310 |
if commit: out_db.commit() |
|
310 |
if commit: out_db.db.commit()
|
|
311 | 311 |
except sql.DatabaseErrors, e: on_error(e) |
312 | 312 |
prep_root() |
313 | 313 |
|
... | ... | |
315 | 315 |
sys.stdout.write('Inserted '+str(row_ins_ct_ref[0])+ |
316 | 316 |
' new rows into database\n') |
317 | 317 |
finally: |
318 |
out_db.rollback() |
|
319 |
out_db.close() |
|
318 |
out_db.db.rollback()
|
|
319 |
out_db.db.close()
|
|
320 | 320 |
else: |
321 | 321 |
def on_error(e): ex_tracker.track(e) |
322 | 322 |
def row_ready(row_num, input_row): pass |
Also available in: Unified diff
sql.py: Wrapped db connection inside an object that can also store the cache of the pkeys and index_cols