aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit910b15ee5975e85cad457ca2508cd3ca7762da41 (patch)
tree5f1d2134c775286bfaccb99ff8af29f469c87bf9
parentc698884787f6d3fa3b4921e8251499a4c0f62141 (diff)
downloadmandoc-910b15ee5975e85cad457ca2508cd3ca7762da41.tar.gz
mandoc-910b15ee5975e85cad457ca2508cd3ca7762da41.tar.zst
mandoc-910b15ee5975e85cad457ca2508cd3ca7762da41.zip
Turning off synchronous mode logically belongs to opening the database,
so move the statement into the function dbopen().
-rw-r--r--mandocdb.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 18c4b9e7..2d376618 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.69 2013/07/02 11:40:40 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.70 2013/07/02 12:58:54 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);
}