这篇教程C++ sqlQuickString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sqlQuickString函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlQuickString函数的具体用法?C++ sqlQuickString怎么用?C++ sqlQuickString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sqlQuickString函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ctdExistsstatic boolean ctdExists(struct section *section, struct sqlConnection *conn, char *geneId)/* Return TRUE if CTD database exists and it has an entry with the gene symbol */{char query[1024];char *geneSymbol;if (isRgdGene(conn)) { if (sqlTableExists(conn, "rgdGene2Xref") == FALSE) return FALSE; }else { if (sqlTableExists(conn, "kgXref") == FALSE) return FALSE; }if (sqlTableExists(conn, "hgFixed.ctdSorted") == TRUE) { if (isRgdGene(conn)) { sqlSafef(query, sizeof(query), "select ChemicalId from rgdGene2Xref x, hgFixed.ctdSorted c" " where x.info=c.GeneSymbol and infoType = 'Name' and rgdGeneId='%s' limit 1", geneId); geneSymbol = sqlQuickString(conn, query); } else { sqlSafef(query, sizeof(query), "select ChemicalId from kgXref x, hgFixed.ctdSorted c" " where x.geneSymbol=c.GeneSymbol and kgId='%s' limit 1", geneId); geneSymbol = sqlQuickString(conn, query); } if (geneSymbol != NULL) return(TRUE); }return(FALSE);}
开发者ID:bowhan,项目名称:kent,代码行数:34,
示例2: geneReviewsExistsstatic boolean geneReviewsExists(struct section *section, struct sqlConnection *conn, char *geneId)/* Return TRUE if geneReviewsDetail table exist and have GeneReviews articles * on this one. */{char query[256];char * geneSymbol;char * grSymbol;if (sqlTableExists(conn, "geneReviewsDetail")) { sqlSafef(query, sizeof(query), "select geneSymbol from kgXref where kgId = '%s'", geneId); geneSymbol = sqlQuickString(conn, query); if (geneSymbol != NULL) { sqlSafef(query, sizeof(query), "select geneSymbol from geneReviewsDetail where geneSymbol='%s'", geneSymbol); grSymbol = sqlQuickString(conn, query); if (grSymbol != NULL) { return TRUE; } } }return FALSE;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:25,
示例3: errAbortchar *bamFileNameFromTable(struct sqlConnection *conn, char *table, char *bamSeqName)/* Return file name from table. If table has a seqName column, then grab the * row associated with bamSeqName (which can be e.g. '1' not 'chr1' if that is the * case in the bam file). */{boolean checkSeqName = (sqlFieldIndex(conn, table, "seqName") >= 0);if (checkSeqName && bamSeqName == NULL) errAbort("bamFileNameFromTable: table %s has seqName column, but NULL seqName passed in", table);char query[512];if (checkSeqName) sqlSafef(query, sizeof(query), "select fileName from %s where seqName = '%s'", table, bamSeqName);else sqlSafef(query, sizeof(query), "select fileName from %s", table);char *fileName = sqlQuickString(conn, query);if (fileName == NULL && checkSeqName) { if (startsWith("chr", bamSeqName)) sqlSafef(query, sizeof(query), "select fileName from %s where seqName = '%s'", table, bamSeqName+strlen("chr")); else sqlSafef(query, sizeof(query), "select fileName from %s where seqName = 'chr%s'", table, bamSeqName); fileName = sqlQuickString(conn, query); }if (fileName == NULL) { if (checkSeqName) errAbort("Missing fileName for seqName '%s' in %s table", bamSeqName, table); else errAbort("Missing fileName in %s table", table); }return fileName;}
开发者ID:davidhoover,项目名称:kent,代码行数:35,
示例4: findClosestServervoid findClosestServer(char **pDb, char **pOrg)/* If db doesn't have a blat server, look for the closest db (or org) that has one, * as hgPcr does. */{char *db = *pDb, *org = *pOrg;struct sqlConnection *conn = hConnectCentral();char query[256];safef(query, sizeof(query), "select db from blatServers where db = '%s'", db);if (!sqlExists(conn, query)) { safef(query, sizeof(query), "select blatServers.db from blatServers,dbDb " "where blatServers.db = dbDb.name and dbDb.genome = '%s'", org); char *db = sqlQuickString(conn, query); if (db == NULL) { safef(query, sizeof(query), "select blatServers.db from blatServers,dbDb " "where blatServers.db = dbDb.name order by dbDb.orderKey,dbDb.name desc"); char *db = sqlQuickString(conn, query); if (db == NULL) errAbort("central database tables blatServers and dbDb are disjoint/empty"); else { *pDb = db; *pOrg = hGenome(db); } } else { *pDb = db; *pOrg = hGenome(db); } }hDisconnectCentral(&conn);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:34,
示例5: verbosechar *docIdSubmit(struct sqlConnection *conn, char *docIdTable, struct docIdSub *docIdSub, char *docIdDir, char *type){verbose(2, "Submitting------/n");verbose(2, "status %d/n", docIdSub->status);verbose(2, "assembly %s/n", docIdSub->assembly);verbose(2, "submitDate %s/n", docIdSub->submitDate);verbose(2, "md5sum %s/n", docIdSub->md5sum);verbose(2, "valReport %s/n", docIdSub->valReport);verbose(2, "valVersion %s/n", docIdSub->valVersion);verbose(2, "metaData %s/n", docIdSub->metaData);verbose(2, "submitPath %s/n", docIdSub->submitPath);verbose(2, "submitter %s/n", docIdSub->submitter);verbose(2, "type %s/n", type);char query[1024 * 1024];fillNull(&docIdSub->valReport);fillNull(&docIdSub->md5sum);sqlSafef(query, sizeof query, "insert into %s (status, assembly, submitDate, md5sum, valReport, valVersion, metaData, submitPath, submitter) values (/"%d/",/"%s/",/"%s/",/"%s/", /"%s/", /"%s/", /"%s/",/"%s/",/"%s/")/n", docIdTable, docIdSub->status, docIdSub->assembly, docIdSub->submitDate, docIdSub->md5sum, docIdSub->valReport, docIdSub->valVersion, docIdSub->metaData, docIdSub->submitPath, docIdSub->submitter); //docIdSub->submitDate, docIdSub->md5sum, docIdSub->valReport, "null", docIdSub->submitPath, docIdSub->submitter);//printf("query is %s/n", query);char *response = sqlQuickString(conn, query);printf("submitted got response %s/n", response);sqlSafef(query, sizeof query, "select last_insert_id()");char *docId = cloneString(sqlQuickString(conn, query));printf("submitted got docId %s/n", docId);if (!fileExists(docIdSub->submitPath)) errAbort("cannot open %s/n", docIdSub->submitPath);char *linkToFile = docIdGetPath(docId, docIdDir, type, docIdSub->submitPath);printf("linking %s to file %s/n", docIdSub->submitPath, linkToFile);char *slash = strrchr(linkToFile, '/');if (slash == NULL) errAbort("can't find slash in path %s/n", linkToFile);*slash = 0;makeDirsOnPath(linkToFile);*slash = '/';if (link(docIdSub->submitPath, linkToFile) < 0) errnoAbort("can't link %s to file %s/n", docIdSub->submitPath, linkToFile);return docId;}
开发者ID:bowhan,项目名称:kent,代码行数:52,
示例6: genomeSettingstatic char *findGeneId(struct sqlConnection *conn, char *name)/* Given some sort of gene name, see if it is in our primary gene table, and if not * look it up in alias table if we have one. */{/* Just check if it's in the main gene table, and if so return input name. */char *mainTable = genomeSetting("knownGene");char query[256];sqlSafef(query, sizeof(query), "select count(*) from %s where name = '%s'", mainTable, name);if (sqlQuickNum(conn, query) > 0) return name;else { /* check OMIM gene symbol table first */ if (sqlTableExists(conn, "omimGeneSymbol")) { sqlSafef(query, sizeof(query), "select geneSymbol from omimGeneSymbol where geneSymbol= '%s'", name); char *symbol = sqlQuickString(conn, query); if (symbol != NULL) { sqlSafef(query, sizeof(query), "select kgId from kgXref where geneSymbol = '%s'", symbol); char *kgId = sqlQuickString(conn, query); if (kgId != NULL) { /* The canonical gene is preferred */ sqlSafef(query, sizeof(query), "select c.transcript from knownCanonical c,knownIsoforms i where i.transcript = '%s' and i.clusterId=c.clusterId", kgId); char *canonicalKgId = sqlQuickString(conn, query); if (canonicalKgId != NULL) { return canonicalKgId; } else return(kgId); } } } }char *alias = genomeOptionalSetting("kgAlias");if (alias != NULL && sqlTableExists(conn, alias)) { sqlSafef(query, sizeof(query), "select kgID from %s where alias = '%s'", alias, name); char *id = sqlQuickString(conn, query); if (id == NULL) hUserAbort("Couldn't find %s in %s.%s or %s.%s", name, database, mainTable, database, alias); return id; }else hUserAbort("Couldn't find %s in %s.%s", name, database, mainTable);return NULL;}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:51,
示例7: safefchar *spCommentVal(struct sqlConnection *conn, int valId)/* Look up text associated with valId. freeMem result when done. */{char query[256];safef(query, sizeof(query), "select val from commentVal where id=%d", valId);return sqlQuickString(conn, query);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:7,
示例8: hFindTableInfostatic char *otherOrgPositionFromDb(struct otherOrg *otherOrg, char *id)/* Get position of id from other organism database, if possible. */{struct hTableInfo *hti = hFindTableInfo(otherOrg->db, NULL, otherOrg->geneTable);if (hti == NULL) return NULL; // table not foundstruct sqlConnection *conn = hAllocConn(otherOrg->db);char query[512];safef(query, sizeof(query), "select concat(%s, ':', %s+1, '-', %s) from %s " "where %s = '%s'", hti->chromField, hti->startField, hti->endField, otherOrg->geneTable, hti->nameField, id);char *pos = sqlQuickString(conn, query);if (pos != NULL) { char posPlus[2048]; safef(posPlus, sizeof(posPlus), "%s&%s=%s&hgFind.matches=%s", pos, otherOrg->geneTable, hTrackOpenVis(sqlGetDatabase(conn), otherOrg->geneTable), id); hFreeConn(&conn); freez(&pos); return cloneString(posPlus); }else { hFreeConn(&conn); return NULL; }}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:33,
示例9: addImagesMatchingStagevoid addImagesMatchingStage(struct visiSearcher *searcher, struct sqlConnection *conn, int schemeId, int taxon, char *minAge, int wordIx, int wordCount)/* Given a developmental stage scheme (schemeId) and a specific * stage, return all images that match stage */{struct dyString *dy = dyStringNew(0);char *maxAge;// note in the code below minAge and maxAge are strings// but they should contain float values. Putting single-quotes// around them and escaping their contents is something that will // protect against sql injection.dyStringClear(dy);sqlDyStringPrintf(dy, "select age from lifeStage where lifeStageScheme = %d ", schemeId);sqlDyStringPrintf(dy, "and age > '%s' order by age", minAge);maxAge = sqlQuickString(conn, dy->string);dyStringClear(dy);sqlDyStringPrintf(dy, "select image.id from specimen,image ");sqlDyStringPrintf(dy, "where specimen.age >= '%s' ", minAge);if (maxAge != NULL) sqlDyStringPrintf(dy, "and specimen.age < '%s' ", maxAge);dyStringPrintf(dy, "and specimen.taxon = %d ", taxon);dyStringPrintf(dy, "and specimen.id = image.specimen");addImagesMatchingQuery(searcher, conn, dy->string, NULL, NULL, wordIx, wordCount);dyStringFree(&dy);}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:32,
示例10: sqlSafefstruct visiMatch *removeMutants(struct sqlConnection *conn, struct visiMatch *matchList)/* Remove images that are associated with mutant genotypes * from list. */{struct visiMatch *match, *next, *newList = NULL;for (match = matchList; match != NULL; match = next) { char *genotype; char query[256]; next = match->next; sqlSafef(query, sizeof(query), "select genotype.alleles from image,specimen,genotype " "where image.id=%d and image.specimen=specimen.id " "and specimen.genotype=genotype.id", match->imageId); genotype = sqlQuickString(conn, query); if (genotype == NULL || genotype[0] == 0 || startsWith("wild type", genotype)) { slAddHead(&newList, match); } freeMem(genotype); }slReverse(&newList);return newList;}
开发者ID:davidhoover,项目名称:kent,代码行数:26,
示例11: doLabContactsvoid doLabContacts(struct cart *theCart){char *subId = cartString(theCart, "lab");cartWebStart(cart, database, "ENCODE DCC: Contacts for submission: %s",subId);struct sqlConnection *conn = sqlConnect(database);char query[10 * 1024];struct sqlResult *sr;char **row;printf("<a href=docIdView?db=%s> Return </a><BR>", database);safef(query, sizeof query, "select user_id from %s where id = %s ", "projects",subId);char *userId = sqlQuickString(conn, query);safef(query, sizeof query, "select name,email,pi from %s where id = '%s' ", "users",userId);sr = sqlGetResult(conn, query);printf("<pre>");while ((row = sqlNextRow(sr)) != NULL) { printf("Name: %s/nEmail: %s/nPI: %s", row[0], row[1], row[2]); }sqlFreeResult(&sr);sqlDisconnect(&conn);cartWebEnd();}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:25,
示例12: addImagesMatchingStagevoid addImagesMatchingStage(struct visiSearcher *searcher, struct sqlConnection *conn, int schemeId, int taxon, char *minAge, int wordIx, int wordCount)/* Given a developmental stage scheme (schemeId) and a specific * stage, return all images that match stage */{struct dyString *dy = dyStringNew(0);char *maxAge;dyStringClear(dy);dyStringPrintf(dy, "select age from lifeStage where lifeStageScheme = %d ", schemeId);dyStringPrintf(dy, "and age > %s order by age", minAge);maxAge = sqlQuickString(conn, dy->string);dyStringClear(dy);dyStringPrintf(dy, "select image.id from specimen,image ");dyStringPrintf(dy, "where specimen.age >= %s ", minAge);if (maxAge != NULL) dyStringPrintf(dy, "and specimen.age < %s ", maxAge);dyStringPrintf(dy, "and specimen.taxon = %d ", taxon);dyStringPrintf(dy, "and specimen.id = image.specimen");addImagesMatchingQuery(searcher, conn, dy->string, NULL, NULL, wordIx, wordCount);dyStringFree(&dy);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:29,
示例13: mrnaDescriptionsPrintstatic void mrnaDescriptionsPrint(struct section *section, struct sqlConnection *conn, char *geneId)/* Print out mrna descriptions annotations. */{struct psl *psl, *pslList = section->items;for (psl = pslList; psl != NULL; psl = psl->next) { if (basesShared(curGenePred, psl) > 12) /* Filter out possible little noisy flecks. */ { char query[512]; char *description; safef(query, sizeof(query), "select description.name from gbCdnaInfo,description" " where gbCdnaInfo.acc='%s' and gbCdnaInfo.description = description.id" , psl->qName); description = sqlQuickString(conn, query); if (description != NULL) { char *url = "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi" "?cmd=Search&db=Nucleotide&term=%s&doptcmdl=GenBank" "&tool=genome.ucsc.edu"; hPrintf("<A HREF=/""); hPrintf(url, psl->qName); hPrintf("/" TARGET=_blank>"); hPrintf("%s</A> - ", psl->qName); hPrintf("%s<BR>", description); } freeMem(description); } }}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:31,
示例14: getEcHtmlvoid getEcHtml(char *ecNumber)/* fetch ec codes and descriptions and output html */{char query[1024];struct sqlConnection *conn = hAllocConn("ec");char *level1 = NULL;char *level2 = NULL;char *level3 = NULL;//char *level4 = NULL;struct ecAttribute attr;char **row = NULL;struct sqlResult *sr = NULL;if (ecNumber == NULL) return;if (conn == NULL) return;sqlSafef(query,sizeof(query), "select distinct e.description from ecAttribute a , ecCode e where a.ec = /"%s/" and a.level1 = e.level1 and e.level2 = 0 ",ecNumber);level1 = sqlQuickString(conn, query);sqlSafef(query,sizeof(query), "select distinct e.description from ecAttribute a , ecCode e where a.ec = /"%s/" and a.level1 = e.level1 and a.level2 = e.level2 and e.level3 = 0 ",ecNumber);level2 = sqlQuickString(conn, query);sqlSafef(query,sizeof(query), "select distinct e.description from ecAttribute a , ecCode e where a.ec = /"%s/" and a.level1 = e.level1 and a.level2 = e.level2 and a.level3 = e.level3 and e.level4 = 0 ",ecNumber);level3 = sqlQuickString(conn, query);//sqlSafef(query,sizeof(query), "select distinct description from ecAttribute a where a.ec = /"%s/" ",ecNumber);//level4 = sqlQuickString(conn, query);printf("[ %s / %s / %s ] <BR>", (level1 != NULL) ? level1 :"n/a", (level2 != NULL) ? level2 :"n/a", (level3 != NULL) ? level3 :"n/a"// (level4 != NULL) ? level4 :"n/a" );sqlSafef(query,sizeof(query), "select * from ecAttribute a where a.ec = /"%s/"",ecNumber);sr = sqlGetResult(conn, query);while ((row = sqlNextRow(sr)) != NULL) { char *attrDesc = NULL; struct sqlConnection *conn2 = hAllocConn("ec"); ecAttributeStaticLoad(row, &attr); sqlSafef(query,sizeof(query), "select description from ecAttributeCode where type = /"%s/" ",attr.type); attrDesc = sqlQuickString(conn2, query); if (differentString(attr.type, "DR")) printf("<B>EC %s:</B> %s<BR>", attrDesc != NULL ? attrDesc : "n/a",attr.description); hFreeConn(&conn2); }hFreeConn(&conn);}
开发者ID:bowhan,项目名称:kent,代码行数:47,
示例15: sqlSafefstatic char *getCgapId(struct sqlConnection *conn)/* Get cgap ID. */{char query[256];sqlSafef(query, sizeof(query), "select cgapId from cgapAlias where alias=/"%s/"", curGeneName);return sqlQuickString(conn, query);}
开发者ID:davidhoover,项目名称:kent,代码行数:8,
示例16: sqlSafefchar *xyzCellVal(struct column *col, struct genePos *gp, struct sqlConnection *conn)/* Make comma separated list of matches to association table. */{ char query[1000]; sqlSafef(query, sizeof(query), "select %s from %s where %s = '%s'", col->valField, col->table, col->keyField, gp->name); return sqlQuickString(conn, query);}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:9,
示例17: checkForGeoMirrorRedirectvoid checkForGeoMirrorRedirect(struct cart *cart)// Implement Geo/IP based redirection.{char *thisNodeStr = geoMirrorNode();if (thisNodeStr) // if geo-mirroring is enabled { char *redirectCookie = findCookieData("redirect"); char *redirect = cgiOptionalString("redirect"); // if we're not already redirected if (redirect == NULL && redirectCookie == NULL) { int thisNode = sqlUnsigned(thisNodeStr); struct sqlConnection *centralConn = hConnectCentral(); char *ipStr = cgiRemoteAddr(); int node = defaultNode(centralConn, ipStr); // if our node is not the node that's closest. if (thisNode != node) { char *geoSuffix = cfgOptionDefault("browser.geoSuffix",""); char query[1056]; sqlSafef(query, sizeof query, "select domain from gbNode%s where node = %d", geoSuffix, node); char *newDomain = sqlQuickString(centralConn, query); char *oldDomain = cgiServerName(); char *port = cgiServerPort(); char *uri = cgiRequestUri(); char *sep = strchr(uri, '?') ? "&" : "?"; int newUriSize = strlen(uri) + 1024; char *newUri = needMem(newUriSize); char *oldUri = needMem(newUriSize); safef(oldUri, newUriSize, "http%s://%s:%s%s%sredirect=manual&source=%s", cgiServerHttpsIsOn() ? "s" : "", oldDomain, port, uri, sep, oldDomain); safef(newUri, newUriSize, "http%s://%s:%s%s%sredirect=manual&source=%s", cgiServerHttpsIsOn() ? "s" : "", newDomain, port, uri, sep, oldDomain); printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=/"javascript:document.getElementById('redirectTd').innerHTML='';/">" "<div style=/"margin: 10px 25%%; border-style:solid; border-width:thin; border-color:#97D897;/">" "<h3 style=/"background-color: #97D897; text-align: left; margin-top:0px; margin-bottom:0px;/">" " You might want to navigate to your nearest mirror - %s" "</h3> " "<ul style=/"margin:5px;/">", newDomain); printf("<li>User settings (sessions and custom tracks) <B>will differ</B> between sites." "<idiv style=/"float:right;/"><a href=/"../goldenPath/help/genomeEuro.html#sessions/">Read more.</a></idiv>"); printf("<li>Take me to <a href=/"%s/">%s</a> </li>", newUri, newDomain); printf("<li>Let me stay here <a href=/"%s/">%s</a>", oldUri, oldDomain ); printf("</div></TD></TR>/n"); exit(0); } hDisconnectCentral(¢ralConn); } }}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:57,
示例18: getExonFramesstatic struct slName* getExonFrames(char *table, struct sqlConnection *conn, struct bed *bedList)/* get real exonFrames if they are available */{struct slName* list = NULL;struct bed *bed;for (bed = bedList; bed != NULL; bed = bed->next) { // be super specific, the same name may align to multiple locations // or even the same location with alternate splicing or exon structure. // convert bed block coordinates to exonStarts, exonEnds int i; struct dyString *exonStarts = newDyString(256); struct dyString *exonEnds = newDyString(256); for( i = 0 ; i < bed->blockCount; i++ ) { int exonStart = bed->chromStart + bed->chromStarts[i]; int exonEnd = exonStart + bed->blockSizes[i]; dyStringPrintf(exonStarts, "%d,", exonStart); dyStringPrintf(exonEnds, "%d,", exonEnd); } char sql[4096+strlen(exonStarts->string)+strlen(exonEnds->string)]; sqlSafef(sql, sizeof sql, "select exonFrames " "from %s where " "name = '%s' and " "chrom = '%s' and " "strand = '%c' and " "txStart = %d and " "txEnd = %d and " "cdsStart = %d and " "cdsEnd = %d and " "exonCount = %d and " "exonStarts = '%s' and " "exonEnds = '%s'" , table, bed->name, bed->chrom, bed->strand[0], bed->chromStart, bed->chromEnd, bed->thickStart, bed->thickEnd, bed->blockCount, exonStarts->string, exonEnds->string ); char *exonFrames = sqlQuickString(conn, sql); slNameAddHead(&list, exonFrames); dyStringFree(&exonStarts); dyStringFree(&exonEnds); }slReverse(&list);return list;}
开发者ID:davidhoover,项目名称:kent,代码行数:56,
示例19: edwSubmitShouldStopboolean edwSubmitShouldStop(struct sqlConnection *conn, unsigned submitId)/* Return TRUE if there's an error message on submit, indicating we should stop. */{char query[256];sqlSafef(query, sizeof(query), "select errorMessage from edwSubmit where id=%u", submitId);char *errorMessage = sqlQuickString(conn, query);boolean ret = isNotEmpty(errorMessage);freez(&errorMessage);return ret;}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:10,
示例20: safefchar *getCdsString(struct sqlConnection *conn, char *acc)/* get the CDS string for an accession, or null if not found */{char query[256];safef(query, sizeof(query), "SELECT cds.name FROM gbCdnaInfo,cds WHERE (gbCdnaInfo.acc = '%s') AND (gbCdnaInfo.cds != 0) AND (gbCdnaInfo.cds = cds.id)", acc);return sqlQuickString(conn, query);}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:10,
示例21: sqlSafefchar *hubNameFromUrl(char *hubUrl)/* Given the URL for a hub, return its hub_# name. */{char query[PATH_LEN*4];sqlSafef(query, sizeof(query), "select concat('hub_', id) from %s where hubUrl = '%s'", getHubStatusTableName(), hubUrl);struct sqlConnection *conn = hConnectCentral();char *name = sqlQuickString(conn, query);hDisconnectCentral(&conn);return name;}
开发者ID:davidhoover,项目名称:kent,代码行数:11,
示例22: cloneString/* Return is an array of integers, last one of value zero to indicate the * end of the array. In case of nothing found in trackDb, return * a NULL pointer indicating no results. * * If the value is 'first' then use the first span value from the table. * Assumes that all values in the table are the same. */int *wiggleSpanList(struct sqlConnection *conn, struct trackDb *tdb){char *tdbDefault = cloneString(trackDbSettingOrDefault(tdb, SPANLIST, "NONE"));int *ret = (int *)NULL;if (sameWord("NONE",tdbDefault)) { struct hashEl *hel; /* if not found in trackDb, maybe it is in tdb->settings * (custom tracks keep settings here) */ if ((tdb->settings != (char *)NULL) && (tdb->settingsHash != (struct hash *)NULL)) { if ((hel = hashLookup(tdb->settingsHash, SPANLIST)) != NULL) { freeMem(tdbDefault); tdbDefault = cloneString((char *)hel->val); } } }/* if we still don't have a spanList, or we got "first" for spanList, * make up spanList by choosing the first span we find in the table *///if (sameWord("NONE",tdbDefault) || sameWord("first",tdbDefault))else if( sameWord("first",tdbDefault)) { char query[1024]; snprintf(query, sizeof(query), "SELECT span FROM %s limit 1", tdb->table ); char *tmpSpan = sqlQuickString(conn, query); AllocArray(ret,2); ret[0] = sqlUnsigned(tmpSpan); ret[1] = 0; freeMem(tmpSpan); }else { /* If something found, let's parse it */ int i; char *words[MAX_SPAN_COUNT]; int wc; wc = chopCommas(tdbDefault,words); AllocArray(ret,wc+1); /* + 1 for the extra zero */ for ( i = 0; i < wc; ++i ) ret[i] = sqlUnsigned(words[i]); intSort(wc,ret); ret[wc] = 0; /* end of list */ }freeMem(tdbDefault);return(ret);} /* int *wiggleSpanList(struct trackDb *tdb) */
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:58,
示例23: tellSubscribersvoid tellSubscribers(struct sqlConnection *conn, char *submitDir, char *submitFileName, unsigned id)/* Tell subscribers that match about file of given id */{char query[256];sqlSafef(query, sizeof(query), "select tags from edwFile where id=%u", id);char *tagsString = sqlQuickString(conn, query);struct hash *tagHash=NULL;struct cgiVar *tagList=NULL;if (!isEmpty(tagsString)) cgiParseInputAbort(tagsString, &tagHash, &tagList);char **row;struct sqlResult *sr = sqlGetResult(conn, "NOSQLINJ select * from edwSubscriber order by runOrder,id");while ((row = sqlNextRow(sr)) != NULL) { struct edwSubscriber *subscriber = edwSubscriberLoad(row); if (wildMatch(subscriber->filePattern, submitFileName) && wildMatch(subscriber->dirPattern, submitDir)) { /* Might have to check for tags match, which involves db load and a cgi vs. cgi compare */ boolean tagsOk = TRUE; if (!isEmpty(subscriber->tagPattern)) { if (tagHash == NULL) // if we're nonempty they better be too tagsOk = FALSE; else { if (!allTagsWildMatch(subscriber->tagPattern, tagHash)) tagsOk = FALSE; } } if (tagsOk) { int maxNumSize=16; // more than enough digits base ten. int maxCommandSize = strlen(subscriber->onFileEndUpload) + maxNumSize + 1; char command[maxCommandSize]; safef(command, sizeof(command), subscriber->onFileEndUpload, id); verbose(2, "system(%s)/n", command); int err = system(command); if (err != 0) warn("err %d from system(%s)/n", err, command); } } edwSubscriberFree(&subscriber); }sqlFreeResult(&sr);freez(&tagsString);slFreeList(&tagList);hashFree(&tagHash);}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:52,
示例24: submitToDirvoid submitToDir(struct sqlConnection *conn, struct sqlConnection *conn2, struct sqlConnection *connSp, char *outDir, char *inJax)/* Create directory full of visiGeneLoad .ra/.tab files from * jackson database connection. Creates a pair of files for * each submission set. Returns outDir. */{struct dyString *query = dyStringNew(0);struct slName *ref, *refList = sqlQuickList(conn, NOSQLINJ "select distinct(_Refs_key) from GXD_Assay");int refCount = 0;makeDir(outDir);for (ref = refList; ref != NULL; ref = ref->next) { char path[PATH_LEN]; char *pub=NULL; boolean skip; /* Check that it isn't on our skip list - one that we * have already in the database from a higher resolution * source. */ dyStringClear(query); sqlDyStringPrintf(query, "select title from BIB_Refs where _Refs_key = %s", ref->name); pub = sqlQuickString(conn, query->string); if (!pub) { verbose(1,"ref %s: missing title from BIB_Refs, ref skipped/n",ref->name); continue; } skip = oneSubmissionSet ? oneSubmissionSet != sqlSigned(ref->name) : FALSE; if (!skip) { safef(path, sizeof(path), "%s/%s", outDir, ref->name); submitRefToFiles(conn, conn2, connSp, ref->name, path, inJax); refCount += 1; if (testMax != 0 && refCount >= testMax) errAbort("Reached testMax %d output dirs [%s]/n", testMax, path); } freeMem(pub); } verbose(1,"refCount=%d/n",refCount);slNameFreeList(&refList);dyStringFree(&query);}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:52,
注:本文中的sqlQuickString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sqlSafef函数代码示例 C++ sqlNextRow函数代码示例 |