src/hg/hgTables/hgTables.c 1.189
1.189 2010/03/25 17:41:25 angie
Use hAllocConnTrack instead of sqlConnect or hAllocConn to support profiles in hg.conf.
Index: src/hg/hgTables/hgTables.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/hgTables.c,v
retrieving revision 1.188
retrieving revision 1.189
diff -b -B -U 4 -r1.188 -r1.189
--- src/hg/hgTables/hgTables.c 4 Jan 2010 19:12:22 -0000 1.188
+++ src/hg/hgTables/hgTables.c 25 Mar 2010 17:41:25 -0000 1.189
@@ -784,10 +784,9 @@
}
return track;
}
-struct grp *makeGroupList(struct sqlConnection *conn,
- struct trackDb *trackList, boolean allTablesOk)
+struct grp *makeGroupList(struct trackDb *trackList, boolean allTablesOk)
/* Get list of groups that actually have something in them. */
{
struct grp *groupsAll, *groupList = NULL, *group;
struct hash *groupsInTrackList = newHash(0);
@@ -963,9 +962,9 @@
hashFree(&uniqHash);
return nameList;
}
-static char *findSelectedTable(struct sqlConnection *conn, struct trackDb *track, char *var)
+static char *findSelectedTable(struct trackDb *track, char *var)
/* Find selected table. Default to main track table if none
* found. */
{
if (track == NULL)
@@ -1041,9 +1040,9 @@
/* If we haven't found the answer but this looks like a non-positional table,
* use the first field. */
if (idField == NULL && !isCustomTrack(table) && (hti == NULL || !hti->isPos))
{
- struct sqlConnection *conn = hAllocConn(db);
+ struct sqlConnection *conn = track ? hAllocConnTrack(db, track) : hAllocConn(db);
struct slName *fieldList = sqlListFields(conn, table);
if (fieldList == NULL)
errAbort("getIdField: Can't find fields of table %s", table);
idField = cloneString(fieldList->name);
@@ -1457,9 +1456,9 @@
sqlFreeResult(&sr);
removeMetaData();
}
-void dispatch(struct sqlConnection *conn);
+void dispatch();
void doTopSubmit(struct sqlConnection *conn)
/* Respond to submit button on top level page.
* This basically just dispatches based on output type. */
@@ -1567,14 +1566,14 @@
else
errAbort("Don't know how to handle %s output yet", output);
}
-void dispatch(struct sqlConnection *conn)
+void dispatch()
/* Scan for 'do' variables and dispatch to appropriate page-generator.
* By default head to the main page. */
{
struct hashEl *varList;
-
+struct sqlConnection *conn = curTrack ? hAllocConnTrack(database, curTrack) : hAllocConn(database);
/* only allows view table schema function for CGB or GSID servers for the time being */
if (hIsCgbServer() || hIsGsidServer())
{
if (cartVarExists(cart, hgtaDoSchema))
@@ -1717,18 +1716,18 @@
}
char *excludeVars[] = {"Submit", "submit", NULL};
-void initGroupsTracksTables(struct sqlConnection *conn)
+void initGroupsTracksTables()
/* Get list of groups that actually have something in them. */
{
fullTrackList = getFullTrackList();
curTrack = findSelectedTrack(fullTrackList, NULL, hgtaTrack);
-fullGroupList = makeGroupList(conn, fullTrackList, allowAllTables());
+fullGroupList = makeGroupList(fullTrackList, allowAllTables());
curGroup = findSelectedGroup(fullGroupList, hgtaGroup);
if (sameString(curGroup->name, "allTables"))
curTrack = NULL;
-curTable = findSelectedTable(conn, curTrack, hgtaTable);
+curTable = findSelectedTable(curTrack, hgtaTable);
if (curTrack == NULL)
{
struct trackDb *tdb = hTrackDbForTrack(database, curTable);
struct trackDb *cTdb = hCompositeTrackDbForSubtrack(database, tdb);
@@ -1744,9 +1743,8 @@
/* hgTables - Get table data associated with tracks and intersect tracks.
* Here we set up cart and some global variables, dispatch the command,
* and put away the cart when it is done. */
{
-struct sqlConnection *conn = NULL;
char *clade = NULL;
oldVars = hashNew(10);
@@ -1757,17 +1755,16 @@
/* Set up global variables. */
allJoiner = joinerRead("all.joiner");
getDbGenomeClade(cart, &database, &genome, &clade, oldVars);
freezeName = hFreezeFromDb(database);
-conn = hAllocConn(database);
setUdcCacheDir();
if (lookupPosition())
{
/* Init track and group lists and figure out what page to put up. */
- initGroupsTracksTables(conn);
- dispatch(conn);
+ initGroupsTracksTables();
+ dispatch();
}
/* Save variables. */
cartCheckout(&cart);