From 23b47a76c2d0b34fa0a6e8bdea1f0c5db87aac33 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Fri, 8 Jun 2012 15:06:28 +0000 Subject: Turn off sqlite3 synchronous mode when creating a new database. This makes it run about 5x faster. While here, wrap some sqlite3 statements in #defines to extract errors. (Really, the warning/error/etc. macros should be functionified.) --- mansearch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'mansearch.c') diff --git a/mansearch.c b/mansearch.c index ad18f942..e3502b99 100644 --- a/mansearch.c +++ b/mansearch.c @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.2 2012/06/08 14:14:30 kristaps Exp $ */ +/* $Id: mansearch.c,v 1.3 2012/06/08 15:06:28 kristaps Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * @@ -38,11 +38,11 @@ #include "mandocdb.h" #include "mansearch.h" -#define BIND_TEXT(_db, _s, _i, _v) \ +#define SQL_BIND_TEXT(_db, _s, _i, _v) \ if (SQLITE_OK != sqlite3_bind_text \ ((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \ fprintf(stderr, "%s\n", sqlite3_errmsg((_db))) -#define BIND_INT64(_db, _s, _i, _v) \ +#define SQL_BIND_INT64(_db, _s, _i, _v) \ if (SQLITE_OK != sqlite3_bind_int64 \ ((_s), (_i)++, (_v))) \ fprintf(stderr, "%s\n", sqlite3_errmsg((_db))) @@ -208,13 +208,13 @@ mansearch(const struct manpaths *paths, fprintf(stderr, "%s\n", sqlite3_errmsg(db)); if (NULL != arch) - BIND_TEXT(db, s, j, arch); + SQL_BIND_TEXT(db, s, j, arch); if (NULL != sec) - BIND_TEXT(db, s, j, arch); + SQL_BIND_TEXT(db, s, j, arch); for (ep = e; NULL != ep; ep = ep->next) { - BIND_TEXT(db, s, j, ep->v); - BIND_INT64(db, s, j, ep->bits); + SQL_BIND_TEXT(db, s, j, ep->v); + SQL_BIND_INT64(db, s, j, ep->bits); } memset(&htab, 0, sizeof(struct ohash)); -- cgit v1.2.3-56-ge451