/* gencodeAnnotationRemark.c was originally generated by the autoSql program, which also 
 * generated gencodeAnnotationRemark.h and gencodeAnnotationRemark.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 "gencodeAnnotationRemark.h"



char *gencodeAnnotationRemarkCommaSepFieldNames = "transcriptId,remark";

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

ret->transcriptId = row[0];
ret->remark = row[1];
}

struct gencodeAnnotationRemark *gencodeAnnotationRemarkLoad(char **row)
/* Load a gencodeAnnotationRemark from row fetched with select * from gencodeAnnotationRemark
 * from database.  Dispose of this with gencodeAnnotationRemarkFree(). */
{
struct gencodeAnnotationRemark *ret;

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

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

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

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

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

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

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

void gencodeAnnotationRemarkFree(struct gencodeAnnotationRemark **pEl)
/* Free a single dynamically allocated gencodeAnnotationRemark such as created
 * with gencodeAnnotationRemarkLoad(). */
{
struct gencodeAnnotationRemark *el;

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

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

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

void gencodeAnnotationRemarkOutput(struct gencodeAnnotationRemark *el, FILE *f, char sep, char lastSep) 
/* Print out gencodeAnnotationRemark.  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->remark);
if (sep == ',') fputc('"',f);
fputc(lastSep,f);
}

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

