summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-07-02 12:58:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-07-02 12:58:54 +0000
commit6510438a900bb9f0b5fda8ef8e673f69eccb5835 (patch)
tree58651931a12cf918e56e8a4255f3ec3c48aafbdb /mandocdb.c
parent7d70d0d341159f15000e6c9c7a25198002cae12d (diff)
downloadmandoc-6510438a900bb9f0b5fda8ef8e673f69eccb5835.tar.gz
Turning off synchronous mode logically belongs to opening the database,
so move the statement into the function dbopen().
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 5f886a5e..27661b6e 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -471,15 +471,6 @@ main(int argc, char *argv[])
if (0 == dbopen(0))
goto out;
- /*
- * Since we're opening up a new database, we can
- * turn off synchronous mode for much better
- * performance.
- */
-#ifndef __APPLE__
- SQL_EXEC("PRAGMA synchronous = OFF");
-#endif
-
ofmerge(mc, mp, &str_info, warnings && !use_all);
dbclose(0);
@@ -1972,6 +1963,17 @@ prepare_statements:
sql = "INSERT INTO keys "
"(bits,key,docid) VALUES (?,?,?)";
sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_KEY], NULL);
+
+#ifndef __APPLE__
+ /*
+ * When opening a new database, we can turn off
+ * synchronous mode for much better performance.
+ */
+
+ if (real)
+ SQL_EXEC("PRAGMA synchronous = OFF");
+#endif
+
return(1);
}