06767e4dcd73d74ff5935fbc141ab44689a03ca3
markd
  Wed Apr 6 23:35:26 2011 -0700
Fix case where databases are split between two servers with a trackDb specifcationpointing to both servers, e.g.:
db.trackDb=localDb:trackDb_markd,db:trackDb

If a given genome databases existed on only one of the servers, then it would
cause an error when checking for a trackDb in that server.  This change
checks for the existance of the database as well as the table.

diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c
index 06cb6fb..afc59e3 100644
--- src/hg/lib/jksql.c
+++ src/hg/lib/jksql.c
@@ -1951,30 +1951,39 @@
 struct sqlConnection *sqlConnCacheAlloc(struct sqlConnCache *cache,
                                         char *database)
 /* Allocate a cached connection. */
 {
 return sqlConnCacheDoAlloc(cache, NULL, database, TRUE);
 }
 
 struct sqlConnection *sqlConnCacheProfileAlloc(struct sqlConnCache *cache,
                                                char *profileName,
                                                char *database)
 /* Allocate a cached connection given a profile and/or database. */
 {
 return sqlConnCacheDoAlloc(cache, profileName, database, TRUE);
 }
 
+struct sqlConnection *sqlConnCacheProfileAllocMaybe(struct sqlConnCache *cache,
+                                                    char *profileName,
+                                                    char *database)
+/* Allocate a cached connection given a profile and/or database. Return NULL
+ * if the database doesn't exist.  */
+{
+return sqlConnCacheDoAlloc(cache, profileName, database, FALSE);
+}
+
 void sqlConnCacheDealloc(struct sqlConnCache *cache, struct sqlConnection **pConn)
 /* Free up a cached connection. */
 {
 struct sqlConnection *conn = *pConn;
 if (conn != NULL)
     {
     if (!conn->inCache)
         errAbort("sqlConnCacheDealloc called on connection that is not associated with a cache");
     assert(!conn->isFree);
     conn->isFree = TRUE;
     struct sqlConnCacheEntry *scce;
     for (scce = cache->entries; (scce != NULL) && (scce->conn != conn); scce = scce->next)
         continue;
     if (scce ==  NULL)
         errAbort("sqlConnCacheDealloc called on cache that doesn't contain "