b274662adfb195dd49ab8de8bb3d5d92f2fb7ca9 braney Sat Aug 6 11:27:33 2011 -0700 add soft-reset button to hgHubConnect (#4815) diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c index af6584d..c98fc84 100644 --- src/hg/lib/hubConnect.c +++ src/hg/lib/hubConnect.c @@ -484,30 +484,51 @@ boolean hubCheckForNew(char *database, struct cart *cart) /* see if the user just typed in a new hub url, return TRUE if so */ { char *url = cartOptionalString(cart, hgHubDataText); if (url != NULL) { trimSpaces(url); getAndSetHubStatus(database, cart, url, TRUE, TRUE); cartRemove(cart, hgHubDataText); return TRUE; } return FALSE; } +unsigned hubResetError(char *url) +/* clear the error for this url in the hubStatus table,return the id */ +{ +struct sqlConnection *conn = hConnectCentral(); +char query[512]; + +safef(query, sizeof(query), "select id from %s where hubUrl = \"%s\"", hubStatusTableName, url); +unsigned id = sqlQuickNum(conn, query); + +if (id == 0) + errAbort("could not find url %s in status table (%s)\n", + url, hubStatusTableName); + +safef(query, sizeof(query), "update %s set errorMessage=\"\" where hubUrl = \"%s\"", hubStatusTableName, url); + +sqlUpdate(conn, query); +hDisconnectCentral(&conn); + +return id; +} + unsigned hubClearStatus(char *url) /* drop the information about this url from the hubStatus table */ { struct sqlConnection *conn = hConnectCentral(); char query[512]; safef(query, sizeof(query), "select id from %s where hubUrl = \"%s\"", hubStatusTableName, url); unsigned id = sqlQuickNum(conn, query); if (id == 0) errAbort("could not find url %s in status table (%s)\n", url, hubStatusTableName); safef(query, sizeof(query), "delete from %s where hubUrl = \"%s\"", hubStatusTableName, url);