您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sqlFreeResult函数代码示例

51自学网 2021-06-03 08:12:15
  C++
这篇教程C++ sqlFreeResult函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sqlFreeResult函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlFreeResult函数的具体用法?C++ sqlFreeResult怎么用?C++ sqlFreeResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sqlFreeResult函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fetchRemapInfo

void fetchRemapInfo(char *db)/* fetch id-remap as a hash using -sqlRemap="some sql" commandline option  * read all the gene aliases from database and put in aliasHash            */{struct sqlConnection* conn = NULL;struct sqlResult *sr;char **row;/* it is possible for each id to have multiple remap values in hash */if (sqlRemap == NULL) return;verbose(2,"beginning processing sqlRemap query [%s] /n",sqlRemap);aliasHash = newHash(8);conn = hAllocConn(db);sr = sqlGetResult(conn, sqlRemap);while ((row = sqlNextRow(sr)) != NULL)    {    hashAdd(aliasHash, row[0], cloneString(row[1]));    }sqlFreeResult(&sr);hFreeConn(&conn);}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:22,


示例2: sequenceTablePrint

void sequenceTablePrint(struct section *section, struct sqlConnection *conn,	char *geneId)/* Print the sequence table. */{char *table = genomeSetting("knownGene");struct dyString *query = newDyString(0);char **row;struct sqlResult *sr;char *chrom;int start,end;/* Print the current position. */webPrintLinkTableStart();printGenomicSeqLink(conn, geneId, curGeneChrom, curGeneStart, curGeneEnd);printMrnaSeqLink(conn,geneId);printProteinSeqLink(conn,geneId);webPrintLinkTableEnd();/* Print out any additional positions. */dyStringPrintf(query, "select chrom,txStart,txEnd from %s", table);dyStringPrintf(query, " where name = '%s'", curGeneId);dyStringPrintf(query, " and (chrom != '%s'", curGeneChrom);dyStringPrintf(query, " or txStart != %d", curGeneStart);dyStringPrintf(query, " or txEnd != %d)", curGeneEnd);sr = sqlGetResult(conn, query->string);while ((row = sqlNextRow(sr)) != NULL)    {    struct sqlConnection *conn2 = hAllocConn(database);    chrom = row[0];    start = atoi(row[1]);    end = atoi(row[2]);    webPrintLinkTableStart();    printGenomicSeqLink(conn2, geneId, chrom, start, end);    webPrintLinkTableEnd();    hFreeConn(&conn2);    }sqlFreeResult(&sr);freeDyString(&query);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:39,


示例3: gvfLoad

static void gvfLoad(struct track *tg)/* Load GVF items from a bed8Attrs database table. */{struct sqlConnection *conn = hAllocConn(database);int rowOffset;struct sqlResult *sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, NULL, &rowOffset);char **row;struct bed8Attrs *list = NULL;// if we someday get dense GVF tracks, might consider upping the default hash size:if (nameHash == NULL)    nameHash= hashNew(0);while ((row = sqlNextRow(sr)) != NULL)    {    struct bed8Attrs *gvf = bed8AttrsLoad(row+rowOffset);    slAddHead(&list, gvf);    hashAdd(nameHash, gvf->name, gvf);    }sqlFreeResult(&sr);hFreeConn(&conn);slSort(&list, gvfHierCmp);tg->items = list;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:22,


示例4: getGenePosition

static void getGenePosition(struct sqlConnection *conn)/* Get gene position from database. */{char *table = genomeSetting("knownGene");char query[256];struct sqlResult *sr;char **row;sqlSafef(query, sizeof(query),    "select chrom,txStart,txEnd from %s where name = '%s'"    , table, curGeneId);sr = sqlGetResult(conn, query);row = sqlNextRow(sr);if (row != NULL)    {    curGeneChrom = cloneString(row[0]);    curGeneStart = atoi(row[1]);    curGeneEnd = atoi(row[2]);    }else    hUserAbort("Couldn't find %s in %s.%s", curGeneId, database, table);sqlFreeResult(&sr);}
开发者ID:maximilianh,项目名称:kent,代码行数:22,


示例5: sqlConnect

/* Copied from hgLoadWiggle. */static struct hash *loadAllChromInfo()/* Load up all chromosome infos. */{struct chromInfo *el;struct sqlConnection *conn = sqlConnect(targetDb);struct sqlResult *sr = NULL;struct hash *ret;char **row;ret = newHash(0);sr = sqlGetResult(conn, "NOSQLINJ select * from chromInfo");while ((row = sqlNextRow(sr)) != NULL)    {    el = chromInfoLoad(row);    verbose(4, "Add hash %s value %u (%#lx)/n", el->chrom, el->size, (unsigned long)&el->size);    hashAdd(ret, el->chrom, (void *)(& el->size));    }sqlFreeResult(&sr);sqlDisconnect(&conn);return ret;}
开发者ID:blumroy,项目名称:kentUtils,代码行数:23,


示例6: hRangeQuery

static struct agpGap *loadAllGaps(struct sqlConnection *conn,	char *db, struct chromInfo *cInfoList)/*	fetch all gaps, returns list of gaps */{ struct agpGap *gapList = NULL;struct chromInfo *cInfo;int gapCount = 0;for (cInfo = cInfoList; cInfo; cInfo = cInfo->next)    {    char **row;    int rowOffset;    struct sqlResult *sr = hRangeQuery(conn, "gap", cInfo->chrom, 0,	cInfo->size, NULL, &rowOffset);    while ((row = sqlNextRow(sr)) != NULL)	{	struct agpGap *gap = agpGapLoad(row+rowOffset);	if (minGap)	    {	    if (gap->size >= minGap)		{		slAddHead(&gapList, gap);		++gapCount;		}	    }	else	    {	    slAddHead(&gapList, gap);	    ++gapCount;	    }	}    sqlFreeResult(&sr);    }slSort(&gapList, bedCmp);if (! insane)    gapSanityCheck(gapList);verbose(2,"#/tfound %d gaps of size >= %d/n", gapCount, minGap);return (gapList);}
开发者ID:blumroy,项目名称:kentUtils,代码行数:39,


示例7: tetCountInChrom

int tetCountInChrom(struct sqlConnection *conn, char *chrom)/* Number of tets in chromosome. */{char query[512];int tetCount = 0;int lastPos = -1000000;struct sqlResult *sr;char **row;int chromPos;sqlSafef(query, sizeof query, "select chromStart from %s_tet_waba", chrom);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    chromPos = sqlUnsigned(row[0]);    if (chromPos - lastPos > 1000)        ++tetCount;    lastPos = chromPos;    }sqlFreeResult(&sr);return tetCount;}
开发者ID:davidhoover,项目名称:kent,代码行数:22,


示例8: doRefGeneProteinSequence

void doRefGeneProteinSequence(struct sqlConnection *conn, struct bed *bedList)/* Fetch refGene proteins corresponding to names in bedList. */{struct hash *uniqHash = newHash(18);struct hash *protHash = newHash(18);struct sqlResult *sr;char **row;struct bed *bed;/* Get translation from mRNA to protein from refLink table. */sr = sqlGetResult(conn, "NOSQLINJ select mrnaAcc,protAcc from refLink");while ((row = sqlNextRow(sr)) != NULL)    {    char *protAcc = row[1];    if (protAcc != NULL && protAcc[0] != 0)        hashAdd(protHash, row[0], lmCloneString(protHash->lm, protAcc));    }sqlFreeResult(&sr);boolean gotResults = FALSE;for (bed = bedList; bed != NULL; bed = bed->next)    {    char *protAcc = hashFindVal(protHash, bed->name);    if (protAcc != NULL && !hashLookup(uniqHash, protAcc))        {	char *fa = hGetSeqAndId(conn, protAcc, NULL);	hashAdd(uniqHash, protAcc, NULL);	if (fa != NULL)	    hPrintf("%s", fa);	freez(&fa);	gotResults = TRUE;	}    }if (!gotResults)    hPrintf(NO_RESULTS);hashFree(&protHash);hashFree(&uniqHash);}
开发者ID:bowhan,项目名称:kent,代码行数:39,


示例9: rbTreeNew

struct rbTree *getTrf(struct sqlConnection *conn, char *chrom)/* Return a tree of ranges for simple repeats in chromosome. */{struct rbTree *tree = rbTreeNew(simpleRangeCmp);struct simpleRange *range, *prevRange = NULL;char query[256];struct sqlResult *sr;char **row;sqlSafef(query, sizeof query, "select chromStart,chromEnd from simpleRepeat "               "where chrom = '%s'",	       chrom);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    lmAllocVar(tree->lm, range);    range->start = sqlUnsigned(row[0]);    range->end = sqlUnsigned(row[1]);    if (prevRange == NULL)	prevRange = range;    else if (overlap(range, prevRange))	{	/* merge r into prevR & discard; prevR gets passed forward. */	if (range->end > prevRange->end)	    prevRange->end = range->end;	if (range->start < prevRange->start)	    prevRange->start = range->start;	}    else	{	rbTreeAdd(tree, prevRange);	prevRange = range;	}    }if (prevRange != NULL)    rbTreeAdd(tree, prevRange);sqlFreeResult(&sr);return tree;}
开发者ID:elmargb,项目名称:kentUtils,代码行数:39,


示例10: getChroms

void getChroms(struct sqlConnection *conn, struct hash **retHash,	       struct chrom **retList)/* Get hash of chromosomes from database. */{struct sqlResult *sr;char **row;struct chrom *chromList = NULL, *chrom;struct hash *hash = hashNew(8);sr = sqlGetResult(conn, "NOSQLINJ select chrom,size from chromInfo");while ((row = sqlNextRow(sr)) != NULL)    {    AllocVar(chrom);    hashAddSaveName(hash, row[0], chrom, &chrom->name);    chrom->size = atoi(row[1]);    slAddHead(&chromList, chrom);    }sqlFreeResult(&sr);slReverse(&chromList);*retHash = hash;*retList = chromList;}
开发者ID:elmargb,项目名称:kentUtils,代码行数:22,


示例11: check

void check(struct sqlConnection *conn, char *table)/* Check it's as planned. */{char query[256], **row;struct sqlResult *sr;int lastEnd = -1, lastStart = -1, start, end;sqlSafef(query, sizeof query, "select chromStart,chromEnd from %s", table);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    start = atoi(row[0]);    end = atoi(row[1]);    if (start < lastStart)        fprintf(stderr,"Out of order: %d,%d/n", lastStart, start);    if (rangeIntersection(lastStart, lastEnd, start-1, end) > 0)        fprintf(stderr,"Overlapping: (%d %d) (%d %d)/n", lastStart, lastEnd, start, end);    lastStart = start;    lastEnd = end;    }sqlFreeResult(&sr);errAbort("All for now");}
开发者ID:elmargb,项目名称:kentUtils,代码行数:22,


示例12: otherOrgPepLink

void otherOrgPepLink(struct otherOrg *otherOrg, char *command, char *label,	char *id, struct sqlConnection *conn)/* Print link that will invoke self to work on other organism peptide. */{boolean gotIt = FALSE;webPrintLinkCellStart();if (id != NULL)    {    if (otherOrg->db != NULL && otherOrg->pepTable != NULL)	{	char dbTable[128];	safef(dbTable, sizeof(dbTable), "%s.%s", otherOrg->db, otherOrg->pepTable);	if (sqlTableExists(conn, dbTable))	    {	    struct sqlResult *sr;	    char **row;	    char query[256];	    safef(query, sizeof(query), "select seq from %s where name = '%s'",	    	dbTable, id);	    sr = sqlGetResult(conn, query);	    if ((row = sqlNextRow(sr)) != NULL)	        {		gotIt = TRUE;		hPrintf("<A HREF=/"%s?%s&%s=%s&%s=%s&%s=%s/" class=/"toc/">",		    geneCgi, cartSidUrlString(cart), 		    command, "on",		    hggOtherPepTable, dbTable,		    hggOtherId, id);		hPrintf("%s", label);		hPrintf("</A>");		}	    sqlFreeResult(&sr);	    }	}    }if (!gotIt)    hPrintf("&nbsp;");webPrintLinkCellEnd();}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:39,


示例13: sqlGetResult

struct psl *pslLoadByQuery(struct sqlConnection *conn, char *query)/* Load all psl 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 pslFreeList(). */{struct psl *list = NULL, *el;struct sqlResult *sr;char **row;int offSet = 0;sr = sqlGetResult(conn, query);offSet = sqlCountColumns(sr) - 21;while ((row = sqlNextRow(sr)) != NULL)    {    el = pslLoad(row+offSet);    slAddHead(&list, el);    }slReverse(&list);sqlFreeResult(&sr);return list;}
开发者ID:elmargb,项目名称:kentUtils,代码行数:22,


示例14: brokenRefPepGetPath

static void brokenRefPepGetPath(struct sqlConnection *conn,                                struct brokenRefPepTbl *brpTbl,                                struct brokenRefPep* brp)/* get path information for one broken refPeps from mrna in reflink.  This * saves the path in the brp and also saves the path in protFaHash so they can * be scanned */{char query[512], **row;struct sqlResult *sr;sqlSafef(query, sizeof(query),      "select refLink.mrnaAcc, gbExtFile.path "      "from refLink,gbSeq,gbExtFile "      "where refLink.protAcc=/"%s/" and gbSeq.acc=refLink.mrnaAcc and gbSeq.gbExtFile=gbExtFile.id",      brp->protAcc);sr= sqlGetResult(conn, query);if ((row = sqlNextRow(sr)) != NULL)    saveProtFastaPath(brpTbl, brp, row[0], row[1]);else    brpTbl->numToDrop++;sqlFreeResult(&sr);}
开发者ID:davidhoover,项目名称:kent,代码行数:22,


示例15: readSnps

void readSnps()/* put all coords in coordHash *//* put names of SNPs that appear 2x or more in nameHash */{char query[512];struct sqlConnection *conn = hAllocConn();struct sqlResult *sr;char **row;struct hashEl *helCoord, *helName = NULL;struct coords *cel = NULL;coordHash = newHash(18);nameHash = newHash(0);verbose(1, "creating hashes.../n");sqlSafef(query, sizeof(query), "select name, chrom, chromStart, chromEnd from snp126");sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    /* have we already seen this snp name? */    /* if so, save it in nameList */    helCoord = hashLookup(coordHash, row[0]);    if (helCoord != NULL)         {	helName = hashLookup(nameHash, row[0]);	if (helName == NULL)	    {	    hashAdd(nameHash, cloneString(row[0]), NULL);	    }	}    /* store all coords */    AllocVar(cel);    cel->chrom = cloneString(row[1]);    cel->start = sqlUnsigned(row[2]);    cel->end = sqlUnsigned(row[3]);    hashAdd(coordHash, cloneString(row[0]), cel);    }sqlFreeResult(&sr);hFreeConn(&conn);}
开发者ID:blumroy,项目名称:kentUtils,代码行数:39,


示例16: assocGroupNew

static struct genePos *wildAssociationFilter(	struct slName *wildList, boolean orLogic, 	struct column *col, struct sqlConnection *conn, struct genePos *list)/* Handle relatively slow filtering when there is a wildcard present. */{struct assocGroup *ag = assocGroupNew(16);struct genePos *gp;struct hash *passHash = newHash(16); /* Hash of items passing filter. */int assocCount = 0;struct sqlResult *sr;char **row;/* Build up associations. */sr = sqlGetResult(conn, col->queryFull);while ((row = sqlNextRow(sr)) != NULL)    {    ++assocCount;    assocGroupAdd(ag, row[0],row[1]);    }sqlFreeResult(&sr);/* Look for matching associations and put them on newList. */for (gp = list; gp != NULL; gp = gp->next)    {    char *key = (col->protKey 	? (kgVersion == KG_III ? lookupProtein(conn, gp->name) : gp->protein)	: gp->name);    struct assocList *al = hashFindVal(ag->listHash, key);    if (al != NULL)	{	if (wildList == NULL || wildMatchRefs(wildList, al->list, orLogic))	    hashAdd(passHash, gp->name, gp);	}    }list = weedUnlessInHash(list, passHash);hashFree(&passHash);assocGroupFree(&ag);return list;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:39,


示例17: hAllocConn

struct slName *getGroupList(char *db, char *group)/* Get list of all rsIds from where clause. */{struct sqlConnection *conn  = hAllocConn(db);struct sqlResult     *sr    = NULL;char                **row   = NULL;struct slName        *list  = NULL;struct slName        *el    = NULL;char                  query[256];sqlSafef(query,sizeof(query),"select name from snp %s", group);sr = sqlGetResult(conn, query);while ((row=sqlNextRow(sr))!=NULL)    {    el = newSlName(row[0]);    slAddHead(&list, el);    }slReverse(&list);sqlFreeResult(&sr);hFreeConn(&conn);return list;}
开发者ID:davidhoover,项目名称:kent,代码行数:22,


示例18: loadOperon

void loadOperon(struct track *tg)/* Load the items in one custom track - just move beds in * window... */{struct linkedFeatures *lfList = NULL, *lf;struct bed *bed, *list = NULL;struct sqlConnection *conn = hAllocConn(database);struct sqlResult *sr;char **row;int rowOffset;sr = hRangeQuery(conn, tg->table, chromName, winStart, winEnd, NULL, &rowOffset);while ((row = sqlNextRow(sr)) != NULL)    {    bed = bedLoadN(row+rowOffset, 15);    slAddHead(&list, bed);    }sqlFreeResult(&sr);hFreeConn(&conn);slReverse(&list);for (bed = list; bed != NULL; bed = bed->next)    {    struct simpleFeature *sf;    int i;    lf = lfFromBed(bed);    sf = lf->components;      for (i = 0; i < bed->expCount; i++)         {	if (sf == NULL)	    break;        sf->grayIx = grayInRange((int)(bed->expScores[i]),0,1000);        sf = sf->next;        }    slAddHead(&lfList,lf);    }tg->items = lfList;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:38,


示例19: gpGeneColor

Color gpGeneColor(struct track *tg, void *item, struct hvGfx *hvg)/* Return color to draw gene (genePred) in. */{struct sqlConnection *conn = hAllocConn(database);struct sqlResult *sr;char query[512];struct linkedFeatures *lf = item;struct COG *COG=NULL;char *temparray[160];char **row;if (lf == NULL)    return shadesOfGray[9];if (lf->name == NULL)    return shadesOfGray[9];if(hTableExists(database, "COG"))    {    sprintf(query, "select * from COG where name = '%s'", lf->name);    sr = sqlGetResult(conn, query);    if ((row = sqlNextRow(sr)) != NULL)	COG = COGLoad(row);    sqlFreeResult(&sr);    hFreeConn(&conn);    initializeColors(hvg);    if(COG!=NULL)	{	chopString(COG->code, "," , temparray, 9999);	return LLshadesOfCOGS[(temparray[0][0]-'A')];	}    else	return shadesOfGray[9];    }else    {    hFreeConn(&conn);    return shadesOfGray[9];    }slFreeList(&lf);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:38,


示例20: doH1n1Seq

void doH1n1Seq(struct trackDb *tdb, char *item)/* Show extra info for H1N1 Seq  Annotations track. */{struct sqlConnection *conn  = hAllocConn(database);struct sqlResult *sr;char query[256];char **row;char *geneSymbol=NULL;genericHeader(tdb, item);sqlSafef(query, sizeof query, "select seqId, geneSymbol, strain, islId from h1n1SeqXref where seqId = '%s'", item);sr = sqlGetResult(conn, query);if ((row = sqlNextRow(sr)) != NULL)    {    char *seqId, *strain, *islId;    seqId      = row[0];    geneSymbol = row[1];    strain     = row[2];    islId      = row[3];    printf("<B>Sequence ID: %s</B> <BR>", seqId);    printf("<B>Gene: %s</B> <BR>", geneSymbol);    printf("<B>Strain: %s</B> <BR>", strain);    printf("<B>Isolate: </B> ");    printf("<A HREF=/"../cgi-bin/gisaidSample?hgs_sample=%s&submit=Go/">%s</A>",     	   islId, islId);    }htmlHorizontalLine();//showSAM_h1n1(item);showProtH1n1(item, geneSymbol);htmlHorizontalLine();printTrackHtml(tdb);sqlFreeResult(&sr);hFreeConn(&conn);}
开发者ID:bowhan,项目名称:kent,代码行数:38,


示例21: hashNew

char *shortOrgName(char *binomial)/* Return short name for taxon - scientific or common whatever is * shorter */{static struct hash *hash = NULL;char *name;if (hash == NULL)    hash = hashNew(0);name = hashFindVal(hash, binomial);if (name == NULL)    {    struct sqlConnection *conn = sqlConnect("uniProt");    char query[256], **row;    struct sqlResult *sr;    int nameSize = strlen(binomial);    name = cloneString(binomial);    sqlSafef(query, sizeof(query),    	"select commonName.val from commonName,taxon "	"where taxon.binomial = '%s' and taxon.id = commonName.taxon"	, binomial);    sr = sqlGetResult(conn, query);    while ((row = sqlNextRow(sr)) != NULL)        {	int len = strlen(row[0]);	if (len < nameSize)	    {	    freeMem(name);	    name = cloneString(row[0]);	    nameSize = len;	    }	}    sqlFreeResult(&sr);    sqlDisconnect(&conn);    hashAdd(hash, binomial, name);    }return name;}
开发者ID:davidhoover,项目名称:kent,代码行数:38,


示例22: doMiddle

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);}
开发者ID:davidhoover,项目名称:kent,代码行数:38,


示例23: hAllocConn

struct snpSimple *readSnpsFromGene(struct genePred *gene, char *chrom)/* read simple snps from txStart to txEnd *//* later change this to cdsStart, cdsEnd */{struct snpSimple *list=NULL, *el;char query[512];struct sqlConnection *conn = hAllocConn();struct sqlResult *sr;char **row;int count = 0;if (strict)    {    sqlSafef(query, sizeof(query), "select name, chromStart, strand, observed from snp "    "where chrom='%s' and chromEnd = chromStart + 1 and class = 'snp' and locType = 'exact' "    "and chromStart >= %d and chromEnd <= %d", chrom, gene->txStart, gene->txEnd);    }else    {    /* this includes snps that are larger than one base */    sqlSafef(query, sizeof(query), "select name, chromStart, strand, observed from snp "    "where chrom='%s' and class = 'snp' "    "and chromStart >= %d and chromEnd <= %d", chrom, gene->txStart, gene->txEnd);    }verbose(4, "query = %s/n", query);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    el = snpSimpleLoad(row);    slAddHead(&list,el);    count++;    }sqlFreeResult(&sr);hFreeConn(&conn);slReverse(&list);  /* could possibly skip if it made much difference in speed. */verbose(4, "Count of snps found = %d/n", count);return list;}
开发者ID:blumroy,项目名称:kentUtils,代码行数:38,


示例24: countBases

int countBases(struct sqlConnection *conn, char *chrom, int chromSize,    char *database)/* Count bases, generally not including gaps, in chromosome. */{static boolean gapsLoaded = FALSE;struct sqlResult *sr;int totalGaps = 0;char **row;int rowOffset;if (countGaps)    return chromSize;/*	If doing all chroms, then load up all the gaps and be done with *	it instead of re-reading the gap table for every chrom */if (sameWord(clChrom,"all"))    {    if (!gapsLoaded)	gapHash = loadAllGaps(conn, database);    gapsLoaded = TRUE;    totalGaps = hashIntValDefault(gapHash, chrom, 0);    }else    {    sr = hChromQuery(conn, "gap", chrom, NULL, &rowOffset);    while ((row = sqlNextRow(sr)) != NULL)	{	int gapSize;	struct agpGap gap;	agpGapStaticLoad(row+rowOffset, &gap);	gapSize = gap.chromEnd - gap.chromStart;	totalGaps += gapSize;	}    sqlFreeResult(&sr);    }return chromSize - totalGaps;}
开发者ID:davidhoover,项目名称:kent,代码行数:38,


示例25: countAlias

static int countAlias(char *id, struct sqlConnection *conn)/* Count how many valid gene symbols to be printed */{char query[256];struct sqlResult *sr;int cnt = 0;char **row;safef(query, sizeof(query), "select alias from kgAlias where kgId = '%s' order by alias", id);sr = sqlGetResult(conn, query);row = sqlNextRow(sr);while (row != NULL)    {    /* skip kgId and the maint gene symbol (curGeneName) */    if ((!sameWord(id, row[0])) && (!sameWord(row[0], curGeneName)))     	{	cnt++;	}    row = sqlNextRow(sr);    }sqlFreeResult(&sr);return(cnt);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:23,


示例26: newHash

struct hash *tableToChromPosHash(struct sqlConnection *conn, char *table, 	char *sql)/* Create hash of chromPos keyed by name field. */ {char query[256];struct sqlResult *sr;char **row;struct hash *hash = newHash(23);struct lm *lm = hash->lm;struct chromPos *pos;sqlSafef(query, sizeof(query), sql, table);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    lmAllocVar(lm, pos);    pos->chrom = lmCloneString(lm, row[0]);    pos->pos = sqlUnsigned(row[1]);    touppers(row[2]);    hashAdd(hash, row[2], pos);    }sqlFreeResult(&sr);return hash;}
开发者ID:davidhoover,项目名称:kent,代码行数:23,


示例27: loadChroms

void loadChroms()/* hash chromNames, create file handles */{char query[512];struct sqlConnection *conn = hAllocConn();struct sqlResult *sr;char **row;FILE *f;char fileName[64];chromHash = newHash(0);sqlSafef(query, sizeof(query), "select chrom from chromInfo");sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    safef(fileName, sizeof(fileName), "%s_snp125hg17ortho.tab", row[0]);    f = mustOpen(fileName, "w");    verbose(1, "chrom = %s/n", row[0]);    hashAdd(chromHash, cloneString(row[0]), f);    }sqlFreeResult(&sr);hFreeConn(&conn);}
开发者ID:elmargb,项目名称:kentUtils,代码行数:23,


示例28: expHistory

void expHistory(int id)/* Show changes to an existing experiment */{// TODO:  Libifyint 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);}
开发者ID:bowhan,项目名称:kent,代码行数:23,


示例29: hConnectCentral

struct dbDb *loadDbInformation_mod(char *database)/* load up the information for a particular draft */{struct sqlConnection *conn = hConnectCentral();struct sqlResult *sr = NULL;char **row;struct dbDb *dbList = NULL, *db = NULL;char query[256];snprintf(query, sizeof(query), "select * from dbDb where name='%s'", database);/* Scan through dbDb table, loading into list */sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    db = dbDbLoad(row);    slAddHead(&dbList, db);    }sqlFreeResult(&sr);hDisconnectCentral(&conn);if(slCount(dbList) != 1)    errAbort("coordConv.c::loadDbInformation() - expecting 1 dbDb record for %s got %d", db, slCount(dbList));return dbList;}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:23,


示例30: sqlConnect

struct hash *readIdHash(char *database, char *table)/* Put an id/name table into a hash keyed by id with * nameId as value. */{struct sqlConnection *conn = sqlConnect(database);struct hash *hash = newHash(0);char query[256];struct sqlResult *sr;char **row;struct nameId *nid;sqlSafef(query, sizeof query, "select id,name from %s", table);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL)    {    AllocVar(nid);    nid->name = cloneString(row[1]);    hashAddSaveName(hash, row[0], nid, &nid->id);    }sqlFreeResult(&sr);sqlDisconnect(&conn);return hash;}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:23,



注:本文中的sqlFreeResult函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sqlGetResult函数代码示例
C++ sqlFixedStringComma函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。