Пример #1
0
struct knownInfo *loadKnownInfo(struct sqlConnection *conn)
/* Load up known info table into list. */
{
struct knownInfo *list = NULL, *el;
struct sqlResult *sr;
char **row;

sr = sqlGetResult(conn, "NOSQLINJ select * from knownInfo");
while ((row = sqlNextRow(sr)) != NULL)
    {
    el = knownInfoLoad(row);
    slAddHead(&list, el);
    }
sqlFreeResult(&sr);
slReverse(&list);
return list;
}
Пример #2
0
void doMiddle()
/* Print middle parts of web page.  Get database and transcript
 * ID from CGI, and print info about that transcript. */
{
char *transId = cgiString("transId");
char *db = cgiString("db");
struct knownInfo *ki, *kiList = NULL;
struct sqlConnection *conn = sqlConnect(db);
struct sqlResult *sr;
char **row;
char query[256];

/* Get a list of all that have that ID. */
sqlSafef(query, sizeof query, "select * from knownInfo where transId = '%s'", transId);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    ki = knownInfoLoad(row);
    slAddHead(&kiList, ki);
    }
sqlFreeResult(&sr);
slReverse(&kiList);

/* Print title that says how many match. */
printf("<H2>Transcript %s - %d match</H2>\n", transId, slCount(kiList));

/* Print some info for each match */
for (ki = kiList; ki != NULL; ki = ki->next)
    {
    printf("<B>geneId</B>: %s<BR>\n", ki->geneId);
    printf("<B>geneName</B>: %s<BR>\n", 
    	lookupName(conn, "geneName", ki->geneName));
    /*  ~~~ Todo: fill in other info.  ~~~ */
    }

knownInfoFreeList(&kiList);
sqlDisconnect(&conn);
}