From 910b15ee5975e85cad457ca2508cd3ca7762da41 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 2 Jul 2013 12:58:54 +0000 Subject: Turning off synchronous mode logically belongs to opening the database, so move the statement into the function dbopen(). --- mandocdb.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'mandocdb.c') 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 * Copyright (c) 2011, 2012, 2013 Ingo Schwarze @@ -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); } -- cgit v1.2.3-56-ge451