533112afe2a2005e80cdb1f82904ea65032d4302 braney Sat Oct 2 11:37:34 2021 -0700 split hg/lib into two separate libaries, one only used by the cgis diff --git src/hg/lib/chicken13kInfo.c src/hg/lib/chicken13kInfo.c deleted file mode 100644 index 7289dce..0000000 --- src/hg/lib/chicken13kInfo.c +++ /dev/null @@ -1,242 +0,0 @@ -/* chicken13kInfo.c was originally generated by the autoSql program, which also - * generated chicken13kInfo.h and chicken13kInfo.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 "chicken13kInfo.h" - - -void chicken13kInfoStaticLoad(char **row, struct chicken13kInfo *ret) -/* Load a row from chicken13kInfo table into ret. The contents of ret will - * be replaced at the next call to this function. */ -{ - -ret->id = row[0]; -ret->source = row[1]; -strcpy(ret->pcr, row[2]); -ret->library = row[3]; -ret->clone = row[4]; -ret->gbkAcc = row[5]; -ret->blat = row[6]; -ret->sourceAnnot = row[7]; -ret->tigrTc = row[8]; -ret->tigrTcAnnot = row[9]; -ret->blastAnnot = row[10]; -ret->comment = row[11]; -} - -struct chicken13kInfo *chicken13kInfoLoad(char **row) -/* Load a chicken13kInfo from row fetched with select * from chicken13kInfo - * from database. Dispose of this with chicken13kInfoFree(). */ -{ -struct chicken13kInfo *ret; - -AllocVar(ret); -ret->id = cloneString(row[0]); -ret->source = cloneString(row[1]); -strcpy(ret->pcr, row[2]); -ret->library = cloneString(row[3]); -ret->clone = cloneString(row[4]); -ret->gbkAcc = cloneString(row[5]); -ret->blat = cloneString(row[6]); -ret->sourceAnnot = cloneString(row[7]); -ret->tigrTc = cloneString(row[8]); -ret->tigrTcAnnot = cloneString(row[9]); -ret->blastAnnot = cloneString(row[10]); -ret->comment = cloneString(row[11]); -return ret; -} - -struct chicken13kInfo *chicken13kInfoLoadAll(char *fileName) -/* Load all chicken13kInfo from a whitespace-separated file. - * Dispose of this with chicken13kInfoFreeList(). */ -{ -struct chicken13kInfo *list = NULL, *el; -struct lineFile *lf = lineFileOpen(fileName, TRUE); -char *row[12]; - -while (lineFileRow(lf, row)) - { - el = chicken13kInfoLoad(row); - slAddHead(&list, el); - } -lineFileClose(&lf); -slReverse(&list); -return list; -} - -struct chicken13kInfo *chicken13kInfoLoadAllByChar(char *fileName, char chopper) -/* Load all chicken13kInfo from a chopper separated file. - * Dispose of this with chicken13kInfoFreeList(). */ -{ -struct chicken13kInfo *list = NULL, *el; -struct lineFile *lf = lineFileOpen(fileName, TRUE); -char *row[12]; - -while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) - { - el = chicken13kInfoLoad(row); - slAddHead(&list, el); - } -lineFileClose(&lf); -slReverse(&list); -return list; -} - -struct chicken13kInfo *chicken13kInfoLoadByQuery(struct sqlConnection *conn, char *query) -/* Load all chicken13kInfo from table that satisfy the query given. - * Where query is of the form 'select * from example where something=something' - * or 'select example.* from example, anotherTable where example.something = - * anotherTable.something'. - * Dispose of this with chicken13kInfoFreeList(). */ -{ -struct chicken13kInfo *list = NULL, *el; -struct sqlResult *sr; -char **row; - -sr = sqlGetResult(conn, query); -while ((row = sqlNextRow(sr)) != NULL) - { - el = chicken13kInfoLoad(row); - slAddHead(&list, el); - } -slReverse(&list); -sqlFreeResult(&sr); -return list; -} - -void chicken13kInfoSaveToDb(struct sqlConnection *conn, struct chicken13kInfo *el, char *tableName, int updateSize) -/* Save chicken13kInfo as a row to the table specified by tableName. - * As blob fields may be arbitrary size updateSize specifies the approx size - * of a string that would contain the entire query. Arrays of native types are - * converted to comma separated strings and loaded as such, User defined types are - * inserted as NULL. Strings are automatically escaped to allow insertion into the database. */ -{ -struct dyString *update = newDyString(updateSize); -sqlDyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s',%s,'%s',%s,%s,%s)", - tableName, el->id, el->source, el->pcr, el->library, el->clone, el->gbkAcc, el->blat, el->sourceAnnot, el->tigrTc, el->tigrTcAnnot, el->blastAnnot, el->comment); -sqlUpdate(conn, update->string); -freeDyString(&update); -} - - -struct chicken13kInfo *chicken13kInfoCommaIn(char **pS, struct chicken13kInfo *ret) -/* Create a chicken13kInfo out of a comma separated string. - * This will fill in ret if non-null, otherwise will - * return a new chicken13kInfo */ -{ -char *s = *pS; - -if (ret == NULL) - AllocVar(ret); -ret->id = sqlStringComma(&s); -ret->source = sqlStringComma(&s); -sqlFixedStringComma(&s, ret->pcr, sizeof(ret->pcr)); -ret->library = sqlStringComma(&s); -ret->clone = sqlStringComma(&s); -ret->gbkAcc = sqlStringComma(&s); -ret->blat = sqlStringComma(&s); -ret->sourceAnnot = sqlStringComma(&s); -ret->tigrTc = sqlStringComma(&s); -ret->tigrTcAnnot = sqlStringComma(&s); -ret->blastAnnot = sqlStringComma(&s); -ret->comment = sqlStringComma(&s); -*pS = s; -return ret; -} - -void chicken13kInfoFree(struct chicken13kInfo **pEl) -/* Free a single dynamically allocated chicken13kInfo such as created - * with chicken13kInfoLoad(). */ -{ -struct chicken13kInfo *el; - -if ((el = *pEl) == NULL) return; -freeMem(el->id); -freeMem(el->source); -freeMem(el->library); -freeMem(el->clone); -freeMem(el->gbkAcc); -freeMem(el->blat); -freeMem(el->sourceAnnot); -freeMem(el->tigrTc); -freeMem(el->tigrTcAnnot); -freeMem(el->blastAnnot); -freeMem(el->comment); -freez(pEl); -} - -void chicken13kInfoFreeList(struct chicken13kInfo **pList) -/* Free a list of dynamically allocated chicken13kInfo's */ -{ -struct chicken13kInfo *el, *next; - -for (el = *pList; el != NULL; el = next) - { - next = el->next; - chicken13kInfoFree(&el); - } -*pList = NULL; -} - -void chicken13kInfoOutput(struct chicken13kInfo *el, FILE *f, char sep, char lastSep) -/* Print out chicken13kInfo. Separate fields with sep. Follow last field with lastSep. */ -{ -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->id); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->source); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->pcr); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->library); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->clone); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->gbkAcc); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->blat); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->sourceAnnot); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->tigrTc); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->tigrTcAnnot); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->blastAnnot); -if (sep == ',') fputc('"',f); -fputc(sep,f); -if (sep == ',') fputc('"',f); -fprintf(f, "%s", el->comment); -if (sep == ',') fputc('"',f); -fputc(lastSep,f); -} - -/* -------------------------------- End autoSql Generated Code -------------------------------- */ -