Revision 2925
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/db_xml.py | ||
---|---|---|
226 | 226 |
# Insert node |
227 | 227 |
pkeys_loc = sql.put_table(db, out_table, in_tables, row, row_ins_ct_ref, |
228 | 228 |
None, next, is_func, on_error) |
229 |
if commit: db.db.commit() |
|
230 | 229 |
|
231 | 230 |
# Insert children with fkeys to parent |
232 | 231 |
parent_ids_loc = pkeys_loc # applies to this section |
bin/map | ||
---|---|---|
324 | 324 |
if n == None: # doing full import |
325 | 325 |
log('Clearing errors table') |
326 | 326 |
sql.truncate(in_db, sql.errors_table(in_db, table)) |
327 |
if commit: in_db.db.commit() |
|
328 | 327 |
|
329 | 328 |
# Strip XML functions not in the DB |
330 | 329 |
special_funcs = db_xml.put_table_special_funcs | rel_funcs |
... | ... | |
422 | 421 |
sql.with_savepoint(out_db, |
423 | 422 |
lambda: db_xml.put(out_db, row_root.firstChild, |
424 | 423 |
row_ins_ct_ref, on_error)) |
425 |
if commit: out_db.db.commit() |
|
426 | 424 |
except sql.DatabaseErrors, e: on_error(e) |
427 | 425 |
|
428 | 426 |
row_ct = process_inputs(root, row_ready) |
bin/csv2db | ||
---|---|---|
59 | 59 |
sql.create_table(db, errors_table, typed_cols, has_pkey=False) |
60 | 60 |
index_cols = ['column', 'value', 'error_code', 'error'] |
61 | 61 |
sql.add_index(db, index_cols, errors_table, unique=True) |
62 |
db.db.commit() |
|
63 | 62 |
|
64 | 63 |
use_copy_from = [True] |
65 | 64 |
|
... | ... | |
122 | 121 |
line_in.close() # also closes proc.stdout |
123 | 122 |
proc.wait() |
124 | 123 |
sql.with_savepoint(db, load_) |
125 |
db.db.commit() |
|
126 | 124 |
|
127 | 125 |
log('Cleaning up table') |
128 | 126 |
sql.cleanup_table(db, table, col_names) |
129 |
db.db.commit() |
|
130 | 127 |
|
131 | 128 |
log('Adding indexes') |
132 | 129 |
for col in typed_cols[1:]: # exclude pkey |
133 | 130 |
log('Adding index on '+col.name) |
134 | 131 |
sql.add_index(db, col.name, table, ensure_not_null=False) |
135 |
db.db.commit() |
|
136 | 132 |
|
137 | 133 |
log('Vacuuming table') |
138 | 134 |
db.db.rollback() |
Also available in: Unified diff
Removed unnecessary db.db.commit() calls because commits are now done automatically by DbConn's autocommit mode