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

/* Copyright (C) 2011 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 "encode/wgEncodeGencodeAnnotationRemark.h"


void wgEncodeGencodeAnnotationRemarkStaticLoad(char **row, struct wgEncodeGencodeAnnotationRemark *ret)
/* Load a row from wgEncodeGencodeAnnotationRemark 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 wgEncodeGencodeAnnotationRemark *wgEncodeGencodeAnnotationRemarkLoad(char **row)
/* Load a wgEncodeGencodeAnnotationRemark from row fetched with select * from wgEncodeGencodeAnnotationRemark
 * from database.  Dispose of this with wgEncodeGencodeAnnotationRemarkFree(). */
{
struct wgEncodeGencodeAnnotationRemark *ret;

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

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

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

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

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

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

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

void wgEncodeGencodeAnnotationRemarkFree(struct wgEncodeGencodeAnnotationRemark **pEl)
/* Free a single dynamically allocated wgEncodeGencodeAnnotationRemark such as created
 * with wgEncodeGencodeAnnotationRemarkLoad(). */
{
struct wgEncodeGencodeAnnotationRemark *el;

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

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

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

void wgEncodeGencodeAnnotationRemarkOutput(struct wgEncodeGencodeAnnotationRemark *el, FILE *f, char sep, char lastSep) 
/* Print out wgEncodeGencodeAnnotationRemark.  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 -------------------------------- */

