source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: better error reporting in case of SQL errors: mention dir and
Date: Sun, 13 Apr 2014 16:55:45 -0400 (EDT)	[thread overview]
Message-ID: <201404132055.s3DKtjg3013449@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2014-04-13 20:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201404132055.s3DKtjg3013449@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).