src/hg/lib/makeItemsItem.c 1.2
1.2 2010/04/09 17:45:57 kent
Updating comment and name.
Index: src/hg/lib/makeItemsItem.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/makeItemsItem.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/hg/lib/makeItemsItem.c 9 Apr 2010 17:44:20 -0000 1.1
+++ src/hg/lib/makeItemsItem.c 9 Apr 2010 17:45:57 -0000 1.2
@@ -1,233 +1,233 @@
/* makeItemsItem.c was originally generated by the autoSql program, which also
* generated makeItemsItem.h and makeItemsItem.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 "makeItemsItem.h"
static char const rcsid[] = "$Id$";
-void makeItemsStaticLoad(char **row, struct makeItems *ret)
-/* Load a row from makeItems table into ret. The contents of ret will
+void makeItemsItemStaticLoad(char **row, struct makeItemsItem *ret)
+/* Load a row from makeItemsItem table into ret. The contents of ret will
* be replaced at the next call to this function. */
{
ret->bin = sqlUnsigned(row[0]);
ret->chrom = row[1];
ret->chromStart = sqlUnsigned(row[2]);
ret->chromEnd = sqlUnsigned(row[3]);
ret->name = row[4];
safecpy(ret->strand, sizeof(ret->strand), row[5]);
ret->score = sqlUnsigned(row[6]);
ret->color = row[7];
ret->description = row[8];
}
-struct makeItems *makeItemsLoadByQuery(struct sqlConnection *conn, char *query)
-/* Load all makeItems from table that satisfy the query given.
+struct makeItemsItem *makeItemsItemLoadByQuery(struct sqlConnection *conn, char *query)
+/* Load all makeItemsItem 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 makeItemsFreeList(). */
+ * Dispose of this with makeItemsItemFreeList(). */
{
-struct makeItems *list = NULL, *el;
+struct makeItemsItem *list = NULL, *el;
struct sqlResult *sr;
char **row;
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
{
- el = makeItemsLoad(row);
+ el = makeItemsItemLoad(row);
slAddHead(&list, el);
}
slReverse(&list);
sqlFreeResult(&sr);
return list;
}
-void makeItemsSaveToDb(struct sqlConnection *conn, struct makeItems *el, char *tableName, int updateSize)
-/* Save makeItems as a row to the table specified by tableName.
+void makeItemsItemSaveToDb(struct sqlConnection *conn, struct makeItemsItem *el, char *tableName, int updateSize)
+/* Save makeItemsItem 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. Note that strings must be escaped to allow insertion into the database.
* For example "autosql's features include" --> "autosql\'s features include"
- * If worried about this use makeItemsSaveToDbEscaped() */
+ * If worried about this use makeItemsItemSaveToDbEscaped() */
{
struct dyString *update = newDyString(updateSize);
dyStringPrintf(update, "insert into %s values ( %u,'%s',%u,%u,'%s','%s',%u,'%s',%s)",
tableName, el->bin, el->chrom, el->chromStart, el->chromEnd, el->name, el->strand, el->score, el->color, el->description);
sqlUpdate(conn, update->string);
freeDyString(&update);
}
-void makeItemsSaveToDbEscaped(struct sqlConnection *conn, struct makeItems *el, char *tableName, int updateSize)
-/* Save makeItems as a row to the table specified by tableName.
+void makeItemsItemSaveToDbEscaped(struct sqlConnection *conn, struct makeItemsItem *el, char *tableName, int updateSize)
+/* Save makeItemsItem 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. Automatically
- * escapes all simple strings (not arrays of string) but may be slower than makeItemsSaveToDb().
+ * escapes all simple strings (not arrays of string) but may be slower than makeItemsItemSaveToDb().
* For example automatically copies and converts:
* "autosql's features include" --> "autosql\'s features include"
* before inserting into database. */
{
struct dyString *update = newDyString(updateSize);
char *chrom, *name, *strand, *color, *description;
chrom = sqlEscapeString(el->chrom);
name = sqlEscapeString(el->name);
strand = sqlEscapeString(el->strand);
color = sqlEscapeString(el->color);
description = sqlEscapeString(el->description);
dyStringPrintf(update, "insert into %s values ( %u,'%s',%u,%u,'%s','%s',%u,'%s','%s')",
tableName, el->bin, chrom, el->chromStart, el->chromEnd, name, strand, el->score, color, description);
sqlUpdate(conn, update->string);
freeDyString(&update);
freez(&chrom);
freez(&name);
freez(&strand);
freez(&color);
freez(&description);
}
-struct makeItems *makeItemsLoad(char **row)
-/* Load a makeItems from row fetched with select * from makeItems
- * from database. Dispose of this with makeItemsFree(). */
+struct makeItemsItem *makeItemsItemLoad(char **row)
+/* Load a makeItemsItem from row fetched with select * from makeItemsItem
+ * from database. Dispose of this with makeItemsItemFree(). */
{
-struct makeItems *ret;
+struct makeItemsItem *ret;
AllocVar(ret);
ret->bin = sqlUnsigned(row[0]);
ret->chrom = cloneString(row[1]);
ret->chromStart = sqlUnsigned(row[2]);
ret->chromEnd = sqlUnsigned(row[3]);
ret->name = cloneString(row[4]);
safecpy(ret->strand, sizeof(ret->strand), row[5]);
ret->score = sqlUnsigned(row[6]);
ret->color = cloneString(row[7]);
ret->description = cloneString(row[8]);
return ret;
}
-struct makeItems *makeItemsLoadAll(char *fileName)
-/* Load all makeItems from a whitespace-separated file.
- * Dispose of this with makeItemsFreeList(). */
+struct makeItemsItem *makeItemsItemLoadAll(char *fileName)
+/* Load all makeItemsItem from a whitespace-separated file.
+ * Dispose of this with makeItemsItemFreeList(). */
{
-struct makeItems *list = NULL, *el;
+struct makeItemsItem *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[9];
while (lineFileRow(lf, row))
{
- el = makeItemsLoad(row);
+ el = makeItemsItemLoad(row);
slAddHead(&list, el);
}
lineFileClose(&lf);
slReverse(&list);
return list;
}
-struct makeItems *makeItemsLoadAllByChar(char *fileName, char chopper)
-/* Load all makeItems from a chopper separated file.
- * Dispose of this with makeItemsFreeList(). */
+struct makeItemsItem *makeItemsItemLoadAllByChar(char *fileName, char chopper)
+/* Load all makeItemsItem from a chopper separated file.
+ * Dispose of this with makeItemsItemFreeList(). */
{
-struct makeItems *list = NULL, *el;
+struct makeItemsItem *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[9];
while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
{
- el = makeItemsLoad(row);
+ el = makeItemsItemLoad(row);
slAddHead(&list, el);
}
lineFileClose(&lf);
slReverse(&list);
return list;
}
-struct makeItems *makeItemsCommaIn(char **pS, struct makeItems *ret)
-/* Create a makeItems out of a comma separated string.
+struct makeItemsItem *makeItemsItemCommaIn(char **pS, struct makeItemsItem *ret)
+/* Create a makeItemsItem out of a comma separated string.
* This will fill in ret if non-null, otherwise will
- * return a new makeItems */
+ * return a new makeItemsItem */
{
char *s = *pS;
if (ret == NULL)
AllocVar(ret);
ret->bin = sqlUnsignedComma(&s);
ret->chrom = sqlStringComma(&s);
ret->chromStart = sqlUnsignedComma(&s);
ret->chromEnd = sqlUnsignedComma(&s);
ret->name = sqlStringComma(&s);
sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
ret->score = sqlUnsignedComma(&s);
ret->color = sqlStringComma(&s);
ret->description = sqlStringComma(&s);
*pS = s;
return ret;
}
-void makeItemsFree(struct makeItems **pEl)
-/* Free a single dynamically allocated makeItems such as created
- * with makeItemsLoad(). */
+void makeItemsItemFree(struct makeItemsItem **pEl)
+/* Free a single dynamically allocated makeItemsItem such as created
+ * with makeItemsItemLoad(). */
{
-struct makeItems *el;
+struct makeItemsItem *el;
if ((el = *pEl) == NULL) return;
freeMem(el->chrom);
freeMem(el->name);
freeMem(el->color);
freeMem(el->description);
freez(pEl);
}
-void makeItemsFreeList(struct makeItems **pList)
-/* Free a list of dynamically allocated makeItems's */
+void makeItemsItemFreeList(struct makeItemsItem **pList)
+/* Free a list of dynamically allocated makeItemsItem's */
{
-struct makeItems *el, *next;
+struct makeItemsItem *el, *next;
for (el = *pList; el != NULL; el = next)
{
next = el->next;
- makeItemsFree(&el);
+ makeItemsItemFree(&el);
}
*pList = NULL;
}
-void makeItemsOutput(struct makeItems *el, FILE *f, char sep, char lastSep)
-/* Print out makeItems. Separate fields with sep. Follow last field with lastSep. */
+void makeItemsItemOutput(struct makeItemsItem *el, FILE *f, char sep, char lastSep)
+/* Print out makeItemsItem. Separate fields with sep. Follow last field with lastSep. */
{
fprintf(f, "%u", el->bin);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->chrom);
if (sep == ',') fputc('"',f);
fputc(sep,f);
fprintf(f, "%u", el->chromStart);
fputc(sep,f);
fprintf(f, "%u", el->chromEnd);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->name);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->strand);
if (sep == ',') fputc('"',f);
fputc(sep,f);
fprintf(f, "%u", el->score);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->color);
if (sep == ',') fputc('"',f);
fputc(sep,f);
if (sep == ',') fputc('"',f);
fprintf(f, "%s", el->description);
if (sep == ',') fputc('"',f);
fputc(lastSep,f);
}
/* -------------------------------- End autoSql Generated Code -------------------------------- */