summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandocdb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mandocdb.c b/mandocdb.c
index c5c7e5b6..f3ac5481 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -969,6 +969,9 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
str_info.hfree = hash_free;
str_info.key_offset = offsetof(struct str, key);
+ if (0 == nodb)
+ SQL_EXEC("BEGIN TRANSACTION");
+
mpage = ohash_first(&mpages, &pslot);
while (NULL != mpage) {
mlinks_undupe(mpage);
@@ -1059,6 +1062,9 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
ohash_delete(&strings);
mpage = ohash_next(&mpages, &pslot);
}
+
+ if (0 == nodb)
+ SQL_EXEC("END TRANSACTION");
}
static void
@@ -1754,8 +1760,6 @@ dbadd(const struct mpage *mpage, struct mchars *mc)
if (nodb)
return;
- SQL_EXEC("BEGIN TRANSACTION");
-
i = 1;
SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, FORM_SRC == mpage->form);
SQL_STEP(stmts[STMT_INSERT_PAGE]);
@@ -1787,8 +1791,6 @@ dbadd(const struct mpage *mpage, struct mchars *mc)
free(key->rendered);
free(key);
}
-
- SQL_EXEC("END TRANSACTION");
}
static void