4b1e60cc4e12743f5d5194decfb10bda2942dc0c galt Thu Apr 30 22:32:27 2020 -0700 adding missing canPcr field. should have been done long ago. diff --git src/hg/lib/blatServers.c src/hg/lib/blatServers.c index 78c3e69..e2fc619 100644 --- src/hg/lib/blatServers.c +++ src/hg/lib/blatServers.c @@ -1,141 +1,141 @@ /* blatServers.c was originally generated by the autoSql program, which also * generated blatServers.h and blatServers.sql. This module links the database and * the RAM representation of objects. */ -/* Copyright (C) 2014 The Regents of the University of California - * See README in this or parent directory for licensing information. */ - #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "blatServers.h" + +char *blatServersCommaSepFieldNames = "db,host,port,isTrans,canPcr"; + void blatServersStaticLoad(char **row, struct blatServers *ret) /* Load a row from blatServers table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->db = row[0]; ret->host = row[1]; ret->port = sqlSigned(row[2]); ret->isTrans = sqlSigned(row[3]); +ret->canPcr = sqlSigned(row[4]); } struct blatServers *blatServersLoad(char **row) /* Load a blatServers from row fetched with select * from blatServers * from database. Dispose of this with blatServersFree(). */ { struct blatServers *ret; AllocVar(ret); ret->db = cloneString(row[0]); ret->host = cloneString(row[1]); ret->port = sqlSigned(row[2]); ret->isTrans = sqlSigned(row[3]); +ret->canPcr = sqlSigned(row[4]); return ret; } struct blatServers *blatServersLoadAll(char *fileName) -/* Load all blatServers from a tab-separated file. +/* Load all blatServers from a whitespace-separated file. * Dispose of this with blatServersFreeList(). */ { struct blatServers *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); -char *row[4]; +char *row[5]; while (lineFileRow(lf, row)) { el = blatServersLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } -struct blatServers *blatServersLoadWhere(struct sqlConnection *conn, char *table, char *where) -/* Load all blatServers from table that satisfy where clause. The - * where clause may be NULL in which case whole table is loaded +struct blatServers *blatServersLoadAllByChar(char *fileName, char chopper) +/* Load all blatServers from a chopper separated file. * Dispose of this with blatServersFreeList(). */ { struct blatServers *list = NULL, *el; -struct dyString *query = dyStringNew(256); -struct sqlResult *sr; -char **row; - -sqlDyStringPrintf(query, "select * from %s", table); -if (where != NULL) - dyStringPrintf(query, " where %s", where); -sr = sqlGetResult(conn, query->string); -while ((row = sqlNextRow(sr)) != NULL) +struct lineFile *lf = lineFileOpen(fileName, TRUE); +char *row[5]; + +while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = blatServersLoad(row); slAddHead(&list, el); } +lineFileClose(&lf); slReverse(&list); -sqlFreeResult(&sr); -dyStringFree(&query); return list; } struct blatServers *blatServersCommaIn(char **pS, struct blatServers *ret) /* Create a blatServers out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new blatServers */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->db = sqlStringComma(&s); ret->host = sqlStringComma(&s); ret->port = sqlSignedComma(&s); ret->isTrans = sqlSignedComma(&s); +ret->canPcr = sqlSignedComma(&s); *pS = s; return ret; } void blatServersFree(struct blatServers **pEl) /* Free a single dynamically allocated blatServers such as created * with blatServersLoad(). */ { struct blatServers *el; if ((el = *pEl) == NULL) return; freeMem(el->db); freeMem(el->host); freez(pEl); } void blatServersFreeList(struct blatServers **pList) /* Free a list of dynamically allocated blatServers's */ { struct blatServers *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; blatServersFree(&el); } *pList = NULL; } void blatServersOutput(struct blatServers *el, FILE *f, char sep, char lastSep) /* Print out blatServers. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->db); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->host); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%d", el->port); fputc(sep,f); fprintf(f, "%d", el->isTrans); +fputc(sep,f); +fprintf(f, "%d", el->canPcr); fputc(lastSep,f); } +/* -------------------------------- End autoSql Generated Code -------------------------------- */ +