/* gencodeTranscriptSupport.c was originally generated by the autoSql program, which also 
 * generated gencodeTranscriptSupport.h and gencodeTranscriptSupport.sql.  This module links the database and
 * the RAM representation of objects. */

#include "common.h"
#include "linefile.h"
#include "dystring.h"
#include "jksql.h"
#include "gencodeTranscriptSupport.h"



char *gencodeTranscriptSupportCommaSepFieldNames = "transcriptId,seqId,seqSrc";

void gencodeTranscriptSupportStaticLoad(char **row, struct gencodeTranscriptSupport *ret)
/* Load a row from gencodeTranscriptSupport table into ret.  The contents of ret will
 * be replaced at the next call to this function. */
{

ret->transcriptId = row[0];
ret->seqId = row[1];
ret->seqSrc = row[2];
}

struct gencodeTranscriptSupport *gencodeTranscriptSupportLoad(char **row)
/* Load a gencodeTranscriptSupport from row fetched with select * from gencodeTranscriptSupport
 * from database.  Dispose of this with gencodeTranscriptSupportFree(). */
{
struct gencodeTranscriptSupport *ret;

AllocVar(ret);
ret->transcriptId = cloneString(row[0]);
ret->seqId = cloneString(row[1]);
ret->seqSrc = cloneString(row[2]);
return ret;
}

struct gencodeTranscriptSupport *gencodeTranscriptSupportLoadAll(char *fileName) 
/* Load all gencodeTranscriptSupport from a whitespace-separated file.
 * Dispose of this with gencodeTranscriptSupportFreeList(). */
{
struct gencodeTranscriptSupport *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[3];

while (lineFileRow(lf, row))
    {
    el = gencodeTranscriptSupportLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}

struct gencodeTranscriptSupport *gencodeTranscriptSupportLoadAllByChar(char *fileName, char chopper) 
/* Load all gencodeTranscriptSupport from a chopper separated file.
 * Dispose of this with gencodeTranscriptSupportFreeList(). */
{
struct gencodeTranscriptSupport *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[3];

while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
    {
    el = gencodeTranscriptSupportLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}

struct gencodeTranscriptSupport *gencodeTranscriptSupportCommaIn(char **pS, struct gencodeTranscriptSupport *ret)
/* Create a gencodeTranscriptSupport out of a comma separated string. 
 * This will fill in ret if non-null, otherwise will
 * return a new gencodeTranscriptSupport */
{
char *s = *pS;

if (ret == NULL)
    AllocVar(ret);
ret->transcriptId = sqlStringComma(&s);
ret->seqId = sqlStringComma(&s);
ret->seqSrc = sqlStringComma(&s);
*pS = s;
return ret;
}

void gencodeTranscriptSupportFree(struct gencodeTranscriptSupport **pEl)
/* Free a single dynamically allocated gencodeTranscriptSupport such as created
 * with gencodeTranscriptSupportLoad(). */
{
struct gencodeTranscriptSupport *el;

if ((el = *pEl) == NULL) return;
freeMem(el->transcriptId);
freeMem(el->seqId);
freeMem(el->seqSrc);
freez(pEl);
}

void gencodeTranscriptSupportFreeList(struct gencodeTranscriptSupport **pList)
/* Free a list of dynamically allocated gencodeTranscriptSupport's */
{
struct gencodeTranscriptSupport *el, *next;

for (el = *pList; el != NULL; el = next)
    {
    next = el->next;
    gencodeTranscriptSupportFree(&el);
    }
*pList = NULL;
}

void gencodeTranscriptSupportOutput(struct gencodeTranscriptSupport *el, FILE *f, char sep, char lastSep) 
/* Print out gencodeTranscriptSupport.  Separate fields with sep. Follow last field with lastSep. */
{
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->transcriptId);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->seqId);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->seqSrc);
if (sep == ',') fputc('"',f);
fputc(lastSep,f);
}

/* -------------------------------- End autoSql Generated Code -------------------------------- */

