Diff
Not logged in

Differences From:

File src/db.c part of check-in [69650f2963] - Better error message when a CGI configuration specifies a non-existant or unreadable repository. by drh on 2008-05-22 15:31:38. [view]

To:

File src/db.c part of check-in [3dce979214] - When reporting database errors in CGI mode, make sure the CGI header comes out first. by drh on 2008-05-24 13:30:36. [view]

@@ -66,10 +66,10 @@
   z = vmprintf(zFormat, ap);
   va_end(ap);
   if( g.cgiPanic ){
     g.cgiPanic = 0;
-    cgi_printf("<p><font color=\"red\">%h</font></p>", z);
-    style_footer();
+    cgi_printf("<h1>Database Error</h1>\n"
+               "<pre>%h</pre>", z);
     cgi_reply();
   }else{
     fprintf(stderr, "%s: %s\n", g.argv[0], z);
   }
@@ -178,9 +178,9 @@
   blob_vappendf(&pStmt->sql, zFormat, ap);
   va_end(ap);
   zSql = blob_str(&pStmt->sql);
   if( sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0)!=0 ){
-    db_err("%s\n%s", zSql, sqlite3_errmsg(g.db));
+    db_err("%s\n%s", sqlite3_errmsg(g.db), zSql);
   }
   pStmt->pNext = pStmt->pPrev = 0;
   return 0;
 }
@@ -212,9 +212,9 @@
 */
 static int paramIdx(Stmt *pStmt, const char *zParamName){
   int i = sqlite3_bind_parameter_index(pStmt->pStmt, zParamName);
   if( i==0 ){
-    db_err("no such bind parameter: %s\n%b", zParamName, &pStmt->sql);
+    db_err("no such bind parameter: %s\nSQL: %b", zParamName, &pStmt->sql);
   }
   return i;
 }
 /*