93f69886bca04e521aa482b21f075cca9dcde37b angie Mon Jun 3 15:25:58 2013 -0700 Added a couple of Galt's new sqlSafef's. diff --git src/hg/hgVai/hgVai.c src/hg/hgVai/hgVai.c index d7d9dc7..4eeb61c 100644 --- src/hg/hgVai/hgVai.c +++ src/hg/hgVai/hgVai.c @@ -446,31 +446,31 @@ printf("%s
\n", description); } } puts("
"); endCollapsibleSection(); } boolean findSnpBed4(char *suffix, char **retFileName, struct trackDb **retTdb) /* If we can find the latest snpNNNsuffix track using 'show tables rlike "regex"', * or better yet a bigBed file for it (faster), * set the appropriate ret* and return TRUE, otherwise return FALSE. */ { if (suffix == NULL) suffix = ""; char query[64]; -safef(query, sizeof(query), "show tables like 'snp1__%s'", suffix); +sqlSafef(query, sizeof(query), "show tables like 'snp1__%s'", suffix); struct sqlConnection *conn = hAllocConn(database); struct slName *snpNNNTables = sqlQuickList(conn, query); hFreeConn(&conn); if (snpNNNTables == NULL) return FALSE; // Skip to last in list -- highest number (show tables can't use rlike or 'order by'): struct slName *table = snpNNNTables; while (table->next != NULL && isdigit(table->next->name[4]) && isdigit(table->next->name[5])) table = table->next; // Do we happen to have a bigBed version? Better yet, bed4 only for current uses: char fileName[HDB_MAX_PATH_STRING]; safef(fileName, sizeof(fileName), "/gbdb/%s/vai/%s.bed4.bb", database, table->name); if (fileExists(fileName)) { if (retFileName != NULL) @@ -800,31 +800,31 @@ /* variantTrack should be either pgSnp or VCF. */ { if (! sameString(tdb->type, "pgSnp") && ! sameString(tdb->type, "vcfTabix")) { errAbort("Expected variant track '%s' to be either pgSnp or vcfTabix, but it's '%s'", tdb->track, tdb->type); } } char *fileNameFromTable(char *table) /* Get fileName from a bigData table (for when we don't have a trackDb, just table). */ { struct sqlConnection *conn = hAllocConn(database); char query[512]; -safef(query, sizeof(query), "select fileName from %s", table); +sqlSafef(query, sizeof(query), "select fileName from %s", table); char *fileName = sqlQuickString(conn, query); hFreeConn(&conn); return fileName; } void textOpen() /* Start serving up plain text, possibly via a pipeline to gzip. */ { char *fileName = cartUsualString(cart, "hgva_outFile", ""); char *compressType = cartUsualString(cart, "hgva_compressType", textOutCompressGzip); compressPipeline = textOutInit(fileName, compressType); } struct annoGrator *gratorForSnp(char *suffix, struct annoAssembly *assembly, char *chrom, enum annoGratorOverlap overlapRule)