예제 #1
0
파일: hgFindSpec.c 프로젝트: bowhan/kent
struct hgFindSpec *hgFindSpecLoadAllByChar(char *fileName, char chopper) 
/* Load all hgFindSpec from a chopper separated file.
 * Dispose of this with hgFindSpecFreeList(). */
{
struct hgFindSpec *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[12];

while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
    {
    el = hgFindSpecLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}
예제 #2
0
파일: hgFindSpec.c 프로젝트: bowhan/kent
struct hgFindSpec *hgFindSpecLoadAll(char *fileName) 
/* Load all hgFindSpec from a whitespace-separated file.
 * Dispose of this with hgFindSpecFreeList(). */
{
struct hgFindSpec *list = NULL, *el;
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *row[12];

while (lineFileRow(lf, row))
    {
    el = hgFindSpecLoad(row);
    slAddHead(&list, el);
    }
lineFileClose(&lf);
slReverse(&list);
return list;
}
예제 #3
0
static struct hgFindSpec *loadFindSpecsTbl(char *db, char *tblSpec, char *where)
/* Load find specs for the given where and a given tblSpec. where can be
 * NULL. */
{
struct hgFindSpec *hfsList = NULL;
char *tbl;
struct sqlConnection *conn = hAllocConnProfileTbl(db, tblSpec, &tbl);
char query[512];
if (where != NULL)
    sqlSafef(query, sizeof(query), "select * from %s where %s", tbl, where);
else
    sqlSafef(query, sizeof(query), "select * from %s", tbl);
struct sqlResult *sr = sqlGetResult(conn, query);
char **row = NULL;
while ((row = sqlNextRow(sr)) != NULL)
    {
    struct hgFindSpec *hfs = hgFindSpecLoad(row);
    if (!haveSpecAlready(hfsList, hfs))
        slAddHead(&hfsList, hfs);
    }
sqlFreeResult(&sr);
hFreeConn(&conn);
return(hfsList);
}