src/hg/lib/hdb.c 1.419
1.419 2010/03/04 05:53:14 angie
Fixed loadGrps to handle profiles.
Index: src/hg/lib/hdb.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hdb.c,v
retrieving revision 1.418
retrieving revision 1.419
diff -b -B -U 4 -r1.418 -r1.419
--- src/hg/lib/hdb.c 6 Feb 2010 21:43:01 -0000 1.418
+++ src/hg/lib/hdb.c 4 Mar 2010 05:53:14 -0000 1.419
@@ -4347,9 +4347,9 @@
return buffer;
}
-static struct grp* loadGrps(struct sqlConnection *conn, char *confName, char *defaultTbl)
+static struct grp* loadGrps(char *db, char *confName, char *defaultTbl)
/* load all of the grp rows from a table. The table name is first looked up
* in hg.conf with confName. If not there, use defaultTbl. If the table
* doesn't exist, return NULL */
{
@@ -4365,11 +4365,13 @@
for (table = tables; table != NULL; table = table->next)
{
struct grp *oneTable = NULL;
- if (sqlTableExists(conn, table->name))
+ char *actualTableName = NULL;
+ struct sqlConnection *conn = hAllocConnProfileTbl(db, table->name, &actualTableName);
+ if (sqlTableExists(conn, actualTableName))
{
- safef(query, sizeof(query), "select * from %s", table->name);
+ safef(query, sizeof(query), "select * from %s", actualTableName);
oneTable = grpLoadByQuery(conn, query);
}
slUniqify(&oneTable, grpCmpName, grpFree);
if (grps && oneTable)
@@ -4383,12 +4385,10 @@
struct grp* hLoadGrps(char *db)
/* load the grp tables using the list configured in hg.conf, returning a list
* sorted by priority. */
{
-struct sqlConnection *conn = hAllocConn(db);
-struct grp *grps = loadGrps(conn, "db.grp", "grp");
+struct grp *grps = loadGrps(db, "db.grp", "grp");
slSort(&grps, grpCmpPriority);
-hFreeConn(&conn);
return grps;
}
int chrStrippedCmp(char *chrA, char *chrB)