diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-13 20:55:45 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-04-13 20:55:45 +0000 |
commit | 8c335297757d885c6bce155f5d8cd2a32d80931b (patch) | |
tree | 1186e925f62e2e7217b16d1a14f44400e240ad99 | |
parent | a5e585fedddeff465f3d03c7056b2649c50593fb (diff) | |
download | mandoc-8c335297757d885c6bce155f5d8cd2a32d80931b.tar.gz |
better error reporting in case of SQL errors: mention dir and file
-rw-r--r-- | mandocdb.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -55,22 +55,22 @@ extern const char *const mansearch_keynames[]; #define SQL_EXEC(_v) \ if (SQLITE_OK != sqlite3_exec(db, (_v), NULL, NULL, NULL)) \ - fprintf(stderr, "%s\n", sqlite3_errmsg(db)) + say("", "%s: %s", (_v), sqlite3_errmsg(db)) #define SQL_BIND_TEXT(_s, _i, _v) \ if (SQLITE_OK != sqlite3_bind_text \ ((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \ - fprintf(stderr, "%s\n", sqlite3_errmsg(db)) + say(mlink->file, "%s", sqlite3_errmsg(db)) #define SQL_BIND_INT(_s, _i, _v) \ if (SQLITE_OK != sqlite3_bind_int \ ((_s), (_i)++, (_v))) \ - fprintf(stderr, "%s\n", sqlite3_errmsg(db)) + say(mlink->file, "%s", sqlite3_errmsg(db)) #define SQL_BIND_INT64(_s, _i, _v) \ if (SQLITE_OK != sqlite3_bind_int64 \ ((_s), (_i)++, (_v))) \ - fprintf(stderr, "%s\n", sqlite3_errmsg(db)) + say(mlink->file, "%s", sqlite3_errmsg(db)) #define SQL_STEP(_s) \ if (SQLITE_DONE != sqlite3_step((_s))) \ - fprintf(stderr, "%s\n", sqlite3_errmsg(db)) + say(mlink->file, "%s", sqlite3_errmsg(db)) enum op { OP_DEFAULT = 0, /* new dbs from dir list or default config */ @@ -1205,7 +1205,6 @@ names_check(void) { sqlite3_stmt *stmt; const char *name, *sec, *arch, *key; - size_t i; int irc; sqlite3_prepare_v2(db, @@ -1221,8 +1220,8 @@ names_check(void) ") USING (pageid);", -1, &stmt, NULL); - i = 1; - SQL_BIND_INT64(stmt, i, NAME_TITLE); + if (SQLITE_OK != sqlite3_bind_int64(stmt, 1, NAME_TITLE)) + say("", "%s", sqlite3_errmsg(db)); while (SQLITE_ROW == (irc = sqlite3_step(stmt))) { name = sqlite3_column_text(stmt, 0); @@ -1957,6 +1956,7 @@ dbadd(struct mpage *mpage, struct mchars *mc) dbadd_mlink(mlink); mlink = mlink->next; } + mlink = mpage->mlinks; for (key = ohash_first(&names, &slot); NULL != key; key = ohash_next(&names, &slot)) { |