abe154b3286cca2b7a54df64f4d041ba19e0b80a max Tue Apr 8 13:27:35 2014 -0700 small changes after code review, refs #13038 diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c index b16f317..a08e6e1 100644 --- src/hg/lib/jksql.c +++ src/hg/lib/jksql.c @@ -703,31 +703,33 @@ return NULL; } } static bool sqlTableCacheTableExists(struct sqlConnection *conn, char* table) /* check if table exists in table name cache */ // (see redmine 3780 for some historical background on this caching) { char query[1024]; char *tableListTable = cfgVal("showTableCache"); sqlSafef(query, sizeof(query), "SELECT count(*) FROM %s WHERE tableName='%s'", tableListTable, table); return (sqlQuickNum(conn, query)!=0); } static struct slName *sqlTableCacheQuery(struct sqlConnection *conn, char *likeExpr) -/* return all table names from the table name cache as a list. +/* This function queries the tableCache table. It is used by the sqlTableList + * function, so it doe not have to connect to the main sql server just to get a list of table names. + * Returns all table names from the table name cache as a list. * Can optionally filter with a likeExpr e.g. "LIKE snp%". */ { char *tableList = cfgVal("showTableCache"); struct slName *list = NULL, *el; char query[1024]; // mysql SHOW TABLES is sorted alphabetically by default if (likeExpr==NULL) sqlSafef(query, sizeof(query), "SELECT DISTINCT tableName FROM %s ORDER BY tableName", tableList); else sqlSafef(query, sizeof(query), "SELECT DISTINCT tableName FROM %s WHERE tableName %s ORDER BY tableName", tableList, likeExpr); struct sqlResult *sr = sqlGetResult(conn, query); char **row; while ((row = sqlNextRow(sr)) != NULL)