080a160c7b9595d516c9c70e83689a09b60839d0
galt
  Mon Jun 3 12:16:53 2013 -0700
fix SQL Injection
diff --git src/hg/lib/ucscRetroInfo.c src/hg/lib/ucscRetroInfo.c
index f7ef9aa..12aef6a 100644
--- src/hg/lib/ucscRetroInfo.c
+++ src/hg/lib/ucscRetroInfo.c
@@ -24,89 +24,44 @@
 while ((row = sqlNextRow(sr)) != NULL)
     {
     el = ucscRetroInfoLoad(row);
     slAddHead(&list, el);
     }
 slReverse(&list);
 sqlFreeResult(&sr);
 return list;
 }
 
 void ucscRetroInfoSaveToDb(struct sqlConnection *conn, struct ucscRetroInfo *el, char *tableName, int updateSize)
 /* Save ucscRetroInfo as a row to the table specified by tableName. 
  * As blob fields may be arbitrary size updateSize specifies the approx size
  * of a string that would contain the entire query. Arrays of native types are
  * converted to comma separated strings and loaded as such, User defined types are
- * inserted as NULL. Note that strings must be escaped to allow insertion into the database.
- * For example "autosql's features include" --> "autosql\'s features include" 
- * If worried about this use ucscRetroInfoSaveToDbEscaped() */
+ * inserted as NULL. Strings are automatically escaped to allow insertion into the database. */
 {
 struct dyString *update = newDyString(updateSize);
 char  *blockSizesArray, *chromStartsArray;
 blockSizesArray = sqlSignedArrayToString(el->blockSizes, el->blockCount);
 chromStartsArray = sqlSignedArrayToString(el->chromStarts, el->blockCount);
-dyStringPrintf(update, "insert into %s values ( '%s',%u,%u,'%s',%u,'%s',%u,%u,%u,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%u,%u,%u,%d,%d,%u,%u,%u,%u,%u,%u,%u,%d,%u,%d,%d,%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%g,%u)", 
+sqlDyStringPrintf(update, "insert into %s values ( '%s',%u,%u,'%s',%u,'%s',%u,%u,%u,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%u,%u,%u,%d,%d,%u,%u,%u,%u,%u,%u,%u,%d,%u,%d,%d,%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%g,%u)", 
 	tableName,  el->chrom,  el->chromStart,  el->chromEnd,  el->name,  el->score,  el->strand,  el->thickStart,  el->thickEnd,  el->reserved,  el->blockCount,  blockSizesArray ,  chromStartsArray ,  el->retroExonCount,  el->axtScore,  el->type,  el->gChrom,  el->gStart,  el->gEnd,  el->gStrand,  el->parentSpliceCount,  el->geneOverlap,  el->polyA,  el->polyAstart,  el->exonCover,  el->intronCount,  el->bestAliCount,  el->matches,  el->qSize,  el->qEnd,  el->tReps,  el->coverage,  el->label,  el->milliBad, el->alignGapCount,  el->processedIntrons,  el->conservedSpliceSites,  el->maxOverlap,  el->refSeq,  el->rStart,  el->rEnd,  el->mgc,  el->mStart,  el->mEnd,  el->kgName,  el->kStart,  el->kEnd,  el->overName,  el->overStart,  el->overExonCover,  el->overStrand,  el->posConf,  el->polyAlen);
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&blockSizesArray);
 freez(&chromStartsArray);
 }
 
-void ucscRetroInfoSaveToDbEscaped(struct sqlConnection *conn, struct ucscRetroInfo *el, char *tableName, int updateSize)
-/* Save ucscRetroInfo as a row to the table specified by tableName. 
- * As blob fields may be arbitrary size updateSize specifies the approx size.
- * of a string that would contain the entire query. Automatically 
- * escapes all simple strings (not arrays of string) but may be slower than ucscRetroInfoSaveToDb().
- * For example automatically copies and converts: 
- * "autosql's features include" --> "autosql\'s features include" 
- * before inserting into database. */ 
-{
-struct dyString *update = newDyString(updateSize);
-char  *chrom, *name, *strand, *blockSizesArray, *chromStartsArray, *type, *gChrom, *gStrand, *refSeq, *mgc, *kgName, *overName, *overStrand;
-chrom = sqlEscapeString(el->chrom);
-name = sqlEscapeString(el->name);
-strand = sqlEscapeString(el->strand);
-type = sqlEscapeString(el->type);
-gChrom = sqlEscapeString(el->gChrom);
-gStrand = sqlEscapeString(el->gStrand);
-refSeq = sqlEscapeString(el->refSeq);
-mgc = sqlEscapeString(el->mgc);
-kgName = sqlEscapeString(el->kgName);
-overName = sqlEscapeString(el->overName);
-overStrand = sqlEscapeString(el->overStrand);
-
-blockSizesArray = sqlSignedArrayToString(el->blockSizes, el->blockCount);
-chromStartsArray = sqlSignedArrayToString(el->chromStarts, el->blockCount);
-dyStringPrintf(update, "insert into %s values ( '%s',%u,%u,'%s',%u,'%s',%u,%u,%u,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%u,%u,%u,%d,%d,%u,%u,%u,%u,%u,%u,%u,%d,%u,%d,%d,%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,%d,'%s',%g,%u)", 
-	tableName,  chrom,  el->chromStart,  el->chromEnd,  name,  el->score,  strand,  el->thickStart,  el->thickEnd,  el->reserved,  el->blockCount,  blockSizesArray ,  chromStartsArray ,  el->retroExonCount,  el->axtScore,  type,  gChrom,  el->gStart,  el->gEnd,  gStrand,  el->parentSpliceCount,  el->geneOverlap,  el->polyA,  el->polyAstart,  el->exonCover,  el->intronCount,  el->bestAliCount,  el->matches,  el->qSize,  el->qEnd,  el->tReps,  el->coverage,  el->label,  el->milliBad, el->alignGapCount,  el->processedIntrons,  el->conservedSpliceSites,  el->maxOverlap,  refSeq,  el->rStart,  el->rEnd,  mgc,  el->mStart,  el->mEnd,  kgName,  el->kStart,  el->kEnd,  overName,  el->overStart,  el->overExonCover,  overStrand,  el->posConf,  el->polyAlen);
-sqlUpdate(conn, update->string);
-freeDyString(&update);
-freez(&chrom);
-freez(&name);
-freez(&strand);
-freez(&blockSizesArray);
-freez(&chromStartsArray);
-freez(&type);
-freez(&gChrom);
-freez(&gStrand);
-freez(&refSeq);
-freez(&mgc);
-freez(&kgName);
-freez(&overName);
-freez(&overStrand);
-}
 
 struct ucscRetroInfo *ucscRetroInfoLoad(char **row)
 /* Load a ucscRetroInfo from row fetched with select * from ucscRetroInfo
  * from database.  Dispose of this with ucscRetroInfoFree(). */
 {
 struct ucscRetroInfo *ret;
 
 AllocVar(ret);
 ret->blockCount = sqlSigned(row[9]);
 ret->chrom = cloneString(row[0]);
 ret->chromStart = sqlUnsigned(row[1]);
 ret->chromEnd = sqlUnsigned(row[2]);
 ret->name = cloneString(row[3]);
 ret->score = sqlUnsigned(row[4]);
 safecpy(ret->strand, sizeof(ret->strand), row[5]);