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

#ifndef OTTOREQUEST_H
#define OTTOREQUEST_H

#include "jksql.h"
#define OTTOREQUEST_NUM_COLS 8

extern char *ottoRequestCommaSepFieldNames;

struct ottoRequest
/* recording requests coming from from functions such as liftRequest */
    {
    struct ottoRequest *next;  /* Next in singly linked list. */
    unsigned id;	/* Auto-incrementing request count */
    char *fromDb;	/* can be a database name or a GC[AF]_ GenArk accession */
    char *toDb;	/* can be a database name or a GC[AF]_ GenArk accession */
    char *email;	/* user email address */
    char *comment;	/* other comments from the input form */
    char *requestTime;	/* date time request was added */
    unsigned char doneStatus;	/* # 1 == alignment is complete, 0 == alignment to be done */
    char *completeTime;	/* date time for alignment completed and user notified */
    };

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

struct ottoRequest *ottoRequestLoadByQuery(struct sqlConnection *conn, char *query);
/* Load all ottoRequest 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 ottoRequestFreeList(). */

void ottoRequestSaveToDb(struct sqlConnection *conn, struct ottoRequest *el, char *tableName, int updateSize);
/* Save ottoRequest 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. This function automatically escapes quoted strings for mysql. */

struct ottoRequest *ottoRequestLoad(char **row);
/* Load a ottoRequest from row fetched with select * from ottoRequest
 * from database.  Dispose of this with ottoRequestFree(). */

struct ottoRequest *ottoRequestLoadAll(char *fileName);
/* Load all ottoRequest from whitespace-separated file.
 * Dispose of this with ottoRequestFreeList(). */

struct ottoRequest *ottoRequestLoadAllByChar(char *fileName, char chopper);
/* Load all ottoRequest from chopper separated file.
 * Dispose of this with ottoRequestFreeList(). */

#define ottoRequestLoadAllByTab(a) ottoRequestLoadAllByChar(a, '\t');
/* Load all ottoRequest from tab separated file.
 * Dispose of this with ottoRequestFreeList(). */

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

void ottoRequestFree(struct ottoRequest **pEl);
/* Free a single dynamically allocated ottoRequest such as created
 * with ottoRequestLoad(). */

void ottoRequestFreeList(struct ottoRequest **pList);
/* Free a list of dynamically allocated ottoRequest's */

void ottoRequestOutput(struct ottoRequest *el, FILE *f, char sep, char lastSep);
/* Print out ottoRequest.  Separate fields with sep. Follow last field with lastSep. */

#define ottoRequestTabOut(el,f) ottoRequestOutput(el,f,'\t','\n');
/* Print out ottoRequest as a line in a tab-separated file. */

#define ottoRequestCommaOut(el,f) ottoRequestOutput(el,f,',',',');
/* Print out ottoRequest as a comma separated list including final comma. */

void ottoRequestJsonOutput(struct ottoRequest *el, FILE *f);
/* Print out ottoRequest in JSON format. */

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

#endif /* OTTOREQUEST_H */

