src/hg/lib/jksql.c 1.128

1.128 2009/02/28 00:34:00 angie
Added sqlSetParanoid; complain about failed MayConnect only if paranoidness is on (the only time we really should complain is when trying to get to the central database.
Index: src/hg/lib/jksql.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/jksql.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -b -B -U 4 -r1.127 -r1.128
--- src/hg/lib/jksql.c	23 Feb 2009 23:38:08 -0000	1.127
+++ src/hg/lib/jksql.c	28 Feb 2009 00:34:00 -0000	1.128
@@ -30,8 +30,9 @@
 static long sqlTotalQueries = 0;            /* total number of queries */
 static boolean monitorHandlerSet = FALSE;   /* is exit handler installed? */
 static unsigned traceIndent = 0;            /* how much to indent */
 static char *indentStr = "                                                       ";
+static boolean sqlParanoid = FALSE;         /* extra squawking */
 
 struct sqlProfile
 /* a configuration profile for connecting to a server */
 {
@@ -663,12 +664,12 @@
     monitorLeave();
     if (abort)
 	errAbort("Couldn't connect to database %s on %s as %s.\n%s", 
 	    database, host, user, mysql_error(conn));
-    else
+    else if (sqlParanoid)
 	fprintf(stderr, "ASH: Couldn't connect to database %s on %s as %s.  "
-		"pid=%ld\nASH: mysql: %s  pid=%ld\n", 
-	    database, host, user, (long)getpid(), mysql_error(conn), (long)getpid());
+		"mysql: %s  pid=%ld\n", 
+		database, host, user, mysql_error(conn), (long)getpid());
     return NULL;
     }
 
 /* Make sure the db is correct in the connect, think usually happens if there
@@ -2415,4 +2416,9 @@
     }
 return cloneString(tableName);
 }
 
+void sqlSetParanoid(boolean beParanoid)
+/* If set to TRUE, will make more diagnostic stderr messages. */
+{
+sqlParanoid = beParanoid;
+}