* mdocml: better error reporting in case of SQL errors: mention dir and
@ 2014-04-13 20:55 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-13 20:55 UTC (permalink / raw)
To: source
Log Message:
-----------
better error reporting in case of SQL errors: mention dir and file
Modified Files:
--------------
mdocml:
mandocdb.c
Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.133 -r1.134
--- mandocdb.c
+++ mandocdb.c
@@ -55,22 +55,22 @@ extern const char *const mansearch_keyna
#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
dbadd_mlink(mlink);
mlink = mlink->next;
}
+ mlink = mpage->mlinks;
for (key = ohash_first(&names, &slot); NULL != key;
key = ohash_next(&names, &slot)) {
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-13 20:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-13 20:55 mdocml: better error reporting in case of SQL errors: mention dir and schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).