예제 #1
0
static struct dyString *asdMakeBaselineQuery(struct annoStreamDb *self, boolean *retHasWhere)
/* Return a baseline query, i.e. "select * from <table>".  This is the default implementation
 * of annoStreamDb.makeBaselineQuery. */
{
if (retHasWhere)
    *retHasWhere = FALSE;
return sqlDyStringCreate("select * from %s ", self->table);
}
예제 #2
0
static struct aHubMatch *filterTrixSearchMatches(struct dbDb *dbDbList,
                                                 struct trixSearchResult *tsrList)
/* Collect the assembly hub matches (not track hub matches) from a search in hub trix files. */
{
if (tsrList == NULL)
    return NULL;
struct aHubMatch *aHubMatchList = NULL;
// Make a hash of local dbs so we can tell which hub dbs must be assembly hubs
// not track hubs.
struct hash *localDbs = hashNew(0);
struct dbDb *dbDb;
for (dbDb = dbDbList;  dbDb != NULL;  dbDb = dbDb->next)
    hashStore(localDbs, dbDb->name);

// tsrList gives hub URLs which we can then look up in hubPublic.
struct dyString *query = sqlDyStringCreate("select shortLabel,hubUrl,dbList from %s "
                                           "where hubUrl in (",
                                           hubPublicTableName());
struct trixSearchResult *tsr;
for (tsr = tsrList;  tsr != NULL; tsr = tsr->next)
    {
    if (tsr != tsrList)
        dyStringAppend(query, ", ");
    dyStringPrintf(query, "'%s'", tsr->itemId);
    }
dyStringAppendC(query, ')');
struct sqlConnection *conn = hConnectCentral();
struct sqlResult *sr = sqlGetResult(conn, query->string);
char **row;
while ((row = sqlNextRow(sr)) != NULL)
    {
    char *shortLabel = row[0];
    char *hubUrl = row[1];
    struct slName *dbName, *dbList = slNameListFromComma(row[2]);
    for (dbName = dbList;  dbName != NULL;  dbName = dbName->next)
        if (! hashLookup(localDbs, dbName->name))
            {
            slAddHead(&aHubMatchList, aHubMatchNew(shortLabel, hubUrl, dbName->name));
            }
    }
slReverse(&aHubMatchList);
hDisconnectCentral(&conn);
return aHubMatchList;
}
예제 #3
0
파일: encodeExp.c 프로젝트: bowhan/kent
void expHistory(int id)
/* Show changes to an existing experiment */
{
// TODO:  Libify

int i;
char **row;
struct dyString *dy = sqlDyStringCreate("select * from %sHistory", table);
if (id != 0)
    dyStringPrintf(dy, " where %s=%d ", ENCODE_EXP_FIELD_IX, id);
dyStringPrintf(dy, " order by updateTime, %s", ENCODE_EXP_FIELD_IX);
struct sqlResult *sr = sqlGetResult(connExp, dyStringCannibalize(&dy));
while ((row = sqlNextRow(sr)) != NULL)
    {
    for (i = 0; i < ENCODEEXP_NUM_COLS+2; i++)
        // history has 2 additional fields:  action and user
        {
        printf("%s\t", row[i]);
        }
    puts("\n");
    }
sqlFreeResult(&sr);
}