44ccfacbe3a3d4b300f80d48651c77837a4b571e galt Tue Apr 26 11:12:02 2022 -0700 SQL INJECTION Prevention Version 2 - this improves our methods by making subclauses of SQL that get passed around be both easy and correct to use. The way that was achieved was by getting rid of the obscure and not well used functions sqlSafefFrag and sqlDyStringPrintfFrag and replacing them with the plain versions of those functions, since these are not needed anymore. The new version checks for NOSQLINJ in unquoted %-s which is used to include SQL clauses, and will give an error the NOSQLINJ clause is not present, and this will automatically require the correct behavior by developers. sqlDyStringPrint is a very useful function, however because it was not enforced, users could use various other dyString functions and they operated without any awareness or checking for SQL correct use. Now those dyString functions are prohibited and it will produce an error if you try to use a dyString function on a SQL string, which is simply detected by the presence of the NOSQLINJ prefix. diff --git src/hg/cirm/cdw/lib/cdw.c src/hg/cirm/cdw/lib/cdw.c index ad645ec..ff32b90 100644 --- src/hg/cirm/cdw/lib/cdw.c +++ src/hg/cirm/cdw/lib/cdw.c @@ -39,35 +39,35 @@ el = cdwSettingsLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwSettingsSaveToDb(struct sqlConnection *conn, struct cdwSettings *el, char *tableName, int updateSize) /* Save cdwSettings 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s')", tableName, el->id, el->name, el->val); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwSettings *cdwSettingsLoad(char **row) /* Load a cdwSettings from row fetched with select * from cdwSettings * from database. Dispose of this with cdwSettingsFree(). */ { struct cdwSettings *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->val = cloneString(row[2]); return ret; } @@ -195,35 +195,35 @@ el = cdwUserLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwUserSaveToDb(struct sqlConnection *conn, struct cdwUser *el, char *tableName, int updateSize) /* Save cdwUser 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s',%d,%u)", tableName, el->id, el->email, el->uuid, el->isAdmin, el->primaryGroup); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwUser *cdwUserLoad(char **row) /* Load a cdwUser from row fetched with select * from cdwUser * from database. Dispose of this with cdwUserFree(). */ { struct cdwUser *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->email = cloneString(row[1]); safecpy(ret->uuid, sizeof(ret->uuid), row[2]); ret->isAdmin = sqlSigned(row[3]); ret->primaryGroup = sqlUnsigned(row[4]); return ret; @@ -356,35 +356,35 @@ el = cdwGroupLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwGroupSaveToDb(struct sqlConnection *conn, struct cdwGroup *el, char *tableName, int updateSize) /* Save cdwGroup 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s')", tableName, el->id, el->name, el->description); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwGroup *cdwGroupLoad(char **row) /* Load a cdwGroup from row fetched with select * from cdwGroup * from database. Dispose of this with cdwGroupFree(). */ { struct cdwGroup *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->description = cloneString(row[2]); return ret; } @@ -509,35 +509,35 @@ el = cdwGroupFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwGroupFileSaveToDb(struct sqlConnection *conn, struct cdwGroupFile *el, char *tableName, int updateSize) /* Save cdwGroupFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u)", tableName, el->fileId, el->groupId); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwGroupFile *cdwGroupFileLoad(char **row) /* Load a cdwGroupFile from row fetched with select * from cdwGroupFile * from database. Dispose of this with cdwGroupFileFree(). */ { struct cdwGroupFile *ret; AllocVar(ret); ret->fileId = sqlUnsigned(row[0]); ret->groupId = sqlUnsigned(row[1]); return ret; } struct cdwGroupFile *cdwGroupFileLoadAll(char *fileName) @@ -652,35 +652,35 @@ el = cdwGroupUserLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwGroupUserSaveToDb(struct sqlConnection *conn, struct cdwGroupUser *el, char *tableName, int updateSize) /* Save cdwGroupUser 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u)", tableName, el->userId, el->groupId); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwGroupUser *cdwGroupUserLoad(char **row) /* Load a cdwGroupUser from row fetched with select * from cdwGroupUser * from database. Dispose of this with cdwGroupUserFree(). */ { struct cdwGroupUser *ret; AllocVar(ret); ret->userId = sqlUnsigned(row[0]); ret->groupId = sqlUnsigned(row[1]); return ret; } struct cdwGroupUser *cdwGroupUserLoadAll(char *fileName) @@ -798,35 +798,35 @@ el = cdwLabLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwLabSaveToDb(struct sqlConnection *conn, struct cdwLab *el, char *tableName, int updateSize) /* Save cdwLab 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s')", tableName, el->id, el->name, el->pi, el->institution, el->url); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwLab *cdwLabLoad(char **row) /* Load a cdwLab from row fetched with select * from cdwLab * from database. Dispose of this with cdwLabFree(). */ { struct cdwLab *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->pi = cloneString(row[2]); ret->institution = cloneString(row[3]); ret->url = cloneString(row[4]); return ret; @@ -969,35 +969,35 @@ el = cdwScriptRegistryLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwScriptRegistrySaveToDb(struct sqlConnection *conn, struct cdwScriptRegistry *el, char *tableName, int updateSize) /* Save cdwScriptRegistry 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,'%s','%s','%s',%d)", tableName, el->id, el->userId, el->name, el->description, el->secretHash, el->submitCount); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwScriptRegistry *cdwScriptRegistryLoad(char **row) /* Load a cdwScriptRegistry from row fetched with select * from cdwScriptRegistry * from database. Dispose of this with cdwScriptRegistryFree(). */ { struct cdwScriptRegistry *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->userId = sqlUnsigned(row[1]); ret->name = cloneString(row[2]); ret->description = cloneString(row[3]); ret->secretHash = cloneString(row[4]); ret->submitCount = sqlSigned(row[5]); @@ -1145,35 +1145,35 @@ el = cdwHostLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwHostSaveToDb(struct sqlConnection *conn, struct cdwHost *el, char *tableName, int updateSize) /* Save cdwHost 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%lld,%lld,%lld,'%s',%lld,%lld,%lld,%d)", tableName, el->id, el->name, el->lastOkTime, el->lastNotOkTime, el->firstAdded, el->errorMessage, el->openSuccesses, el->openFails, el->historyBits, el->paraFetchStreams); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwHost *cdwHostLoad(char **row) /* Load a cdwHost from row fetched with select * from cdwHost * from database. Dispose of this with cdwHostFree(). */ { struct cdwHost *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->lastOkTime = sqlLongLong(row[2]); ret->lastNotOkTime = sqlLongLong(row[3]); ret->firstAdded = sqlLongLong(row[4]); ret->errorMessage = cloneString(row[5]); @@ -1334,35 +1334,35 @@ el = cdwSubmitDirLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwSubmitDirSaveToDb(struct sqlConnection *conn, struct cdwSubmitDir *el, char *tableName, int updateSize) /* Save cdwSubmitDir 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%u,%lld,%lld,%lld,'%s',%lld,%lld,%lld)", tableName, el->id, el->url, el->hostId, el->lastOkTime, el->lastNotOkTime, el->firstAdded, el->errorMessage, el->openSuccesses, el->openFails, el->historyBits); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwSubmitDir *cdwSubmitDirLoad(char **row) /* Load a cdwSubmitDir from row fetched with select * from cdwSubmitDir * from database. Dispose of this with cdwSubmitDirFree(). */ { struct cdwSubmitDir *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->url = cloneString(row[1]); ret->hostId = sqlUnsigned(row[2]); ret->lastOkTime = sqlLongLong(row[3]); ret->lastNotOkTime = sqlLongLong(row[4]); ret->firstAdded = sqlLongLong(row[5]); @@ -1516,35 +1516,35 @@ el = cdwMetaTagsLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwMetaTagsSaveToDb(struct sqlConnection *conn, struct cdwMetaTags *el, char *tableName, int updateSize) /* Save cdwMetaTags 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s')", tableName, el->id, el->md5, el->tags); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwMetaTags *cdwMetaTagsLoad(char **row) /* Load a cdwMetaTags from row fetched with select * from cdwMetaTags * from database. Dispose of this with cdwMetaTagsFree(). */ { struct cdwMetaTags *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); safecpy(ret->md5, sizeof(ret->md5), row[1]); ret->tags = cloneString(row[2]); return ret; } @@ -1685,35 +1685,35 @@ el = cdwFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwFileSaveToDb(struct sqlConnection *conn, struct cdwFile *el, char *tableName, int updateSize) /* Save cdwFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%u,'%s','%s',%lld,%lld,%lld,%lld,'%s','%s',%u,'%s','%s',%u,%d,%d,%d)", tableName, el->id, el->submitId, el->submitDirId, el->userId, el->submitFileName, el->cdwFileName, el->startUploadTime, el->endUploadTime, el->updateTime, el->size, el->md5, el->tags, el->metaTagsId, el->errorMessage, el->deprecated, el->replacedBy, el->userAccess, el->groupAccess, el->allAccess); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwFile *cdwFileLoad(char **row) /* Load a cdwFile from row fetched with select * from cdwFile * from database. Dispose of this with cdwFileFree(). */ { struct cdwFile *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->submitId = sqlUnsigned(row[1]); ret->submitDirId = sqlUnsigned(row[2]); ret->userId = sqlUnsigned(row[3]); ret->submitFileName = cloneString(row[4]); ret->cdwFileName = cloneString(row[5]); @@ -1929,35 +1929,35 @@ el = cdwSubmitLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwSubmitSaveToDb(struct sqlConnection *conn, struct cdwSubmit *el, char *tableName, int updateSize) /* Save cdwSubmit 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%lld,%lld,%u,%u,%u,%u,%u,%u,%u,%lld,%lld,%lld,'%s',%u,%u,'%s')", tableName, el->id, el->url, el->startUploadTime, el->endUploadTime, el->userId, el->manifestFileId, el->metaFileId, el->submitDirId, el->fileCount, el->oldFiles, el->newFiles, el->byteCount, el->oldBytes, el->newBytes, el->errorMessage, el->fileIdInTransit, el->metaChangeCount, el->wrangler); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwSubmit *cdwSubmitLoad(char **row) /* Load a cdwSubmit from row fetched with select * from cdwSubmit * from database. Dispose of this with cdwSubmitFree(). */ { struct cdwSubmit *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->url = cloneString(row[1]); ret->startUploadTime = sqlLongLong(row[2]); ret->endUploadTime = sqlLongLong(row[3]); ret->userId = sqlUnsigned(row[4]); ret->manifestFileId = sqlUnsigned(row[5]); @@ -2150,35 +2150,35 @@ el = cdwSubscriberLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwSubscriberSaveToDb(struct sqlConnection *conn, struct cdwSubscriber *el, char *tableName, int updateSize) /* Save cdwSubscriber 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%g,'%s','%s','%s','%s')", tableName, el->id, el->name, el->runOrder, el->filePattern, el->dirPattern, el->tagPattern, el->onFileEndUpload); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwSubscriber *cdwSubscriberLoad(char **row) /* Load a cdwSubscriber from row fetched with select * from cdwSubscriber * from database. Dispose of this with cdwSubscriberFree(). */ { struct cdwSubscriber *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->runOrder = sqlDouble(row[2]); ret->filePattern = cloneString(row[3]); ret->dirPattern = cloneString(row[4]); ret->tagPattern = cloneString(row[5]); @@ -2334,35 +2334,35 @@ el = cdwAssemblyLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwAssemblySaveToDb(struct sqlConnection *conn, struct cdwAssembly *el, char *tableName, int updateSize) /* Save cdwAssembly 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,'%s','%s',%u,%lld,%lld,%u)", tableName, el->id, el->taxon, el->name, el->ucscDb, el->twoBitId, el->baseCount, el->realBaseCount, el->seqCount); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwAssembly *cdwAssemblyLoad(char **row) /* Load a cdwAssembly from row fetched with select * from cdwAssembly * from database. Dispose of this with cdwAssemblyFree(). */ { struct cdwAssembly *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->taxon = sqlUnsigned(row[1]); ret->name = cloneString(row[2]); ret->ucscDb = cloneString(row[3]); ret->twoBitId = sqlUnsigned(row[4]); ret->baseCount = sqlLongLong(row[5]); @@ -2509,35 +2509,35 @@ el = cdwBiosampleLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwBiosampleSaveToDb(struct sqlConnection *conn, struct cdwBiosample *el, char *tableName, int updateSize) /* Save cdwBiosample 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%u,'%s')", tableName, el->id, el->term, el->taxon, el->sex); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwBiosample *cdwBiosampleLoad(char **row) /* Load a cdwBiosample from row fetched with select * from cdwBiosample * from database. Dispose of this with cdwBiosampleFree(). */ { struct cdwBiosample *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->term = cloneString(row[1]); ret->taxon = sqlUnsigned(row[2]); ret->sex = cloneString(row[3]); return ret; } @@ -2672,35 +2672,35 @@ el = cdwExperimentLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwExperimentSaveToDb(struct sqlConnection *conn, struct cdwExperiment *el, char *tableName, int updateSize) /* Save cdwExperiment 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( '%s','%s','%s','%s','%s','%s','%s','%s')", tableName, el->accession, el->dataType, el->lab, el->biosample, el->rfa, el->assayType, el->ipTarget, el->control); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwExperiment *cdwExperimentLoad(char **row) /* Load a cdwExperiment from row fetched with select * from cdwExperiment * from database. Dispose of this with cdwExperimentFree(). */ { struct cdwExperiment *ret; AllocVar(ret); safecpy(ret->accession, sizeof(ret->accession), row[0]); ret->dataType = cloneString(row[1]); ret->lab = cloneString(row[2]); ret->biosample = cloneString(row[3]); ret->rfa = cloneString(row[4]); ret->assayType = cloneString(row[5]); @@ -2884,35 +2884,35 @@ el = cdwValidFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwValidFileSaveToDb(struct sqlConnection *conn, struct cdwValidFile *el, char *tableName, int updateSize) /* Save cdwValidFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%u,'%s','%s','%s','%s','%s','%s',%lld,%lld,%lld,%lld,'%s',%g,%g,%g,%d,%d,'%s','%s',%d,%g,'%s')", tableName, el->id, el->licensePlate, el->fileId, el->format, el->outputType, el->experiment, el->replicate, el->enrichedIn, el->ucscDb, el->itemCount, el->basesInItems, el->sampleCount, el->basesInSample, el->sampleBed, el->mapRatio, el->sampleCoverage, el->depth, el->singleQaStatus, el->replicateQaStatus, el->part, el->pairedEnd, el->qaVersion, el->uniqueMapRatio, el->lane); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwValidFile *cdwValidFileLoad(char **row) /* Load a cdwValidFile from row fetched with select * from cdwValidFile * from database. Dispose of this with cdwValidFileFree(). */ { struct cdwValidFile *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); safecpy(ret->licensePlate, sizeof(ret->licensePlate), row[1]); ret->fileId = sqlUnsigned(row[2]); ret->format = cloneString(row[3]); ret->outputType = cloneString(row[4]); ret->experiment = cloneString(row[5]); @@ -3138,42 +3138,42 @@ el = cdwFastqFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwFastqFileSaveToDb(struct sqlConnection *conn, struct cdwFastqFile *el, char *tableName, int updateSize) /* Save cdwFastqFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); char *qualPosArray, *aAtPosArray, *cAtPosArray, *gAtPosArray, *tAtPosArray, *nAtPosArray; qualPosArray = sqlDoubleArrayToString(el->qualPos, el->readSizeMax); aAtPosArray = sqlDoubleArrayToString(el->aAtPos, el->readSizeMax); cAtPosArray = sqlDoubleArrayToString(el->cAtPos, el->readSizeMax); gAtPosArray = sqlDoubleArrayToString(el->gAtPos, el->readSizeMax); tAtPosArray = sqlDoubleArrayToString(el->tAtPos, el->readSizeMax); nAtPosArray = sqlDoubleArrayToString(el->nAtPos, el->readSizeMax); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%lld,%lld,'%s',%lld,%lld,%g,%g,%d,%d,%g,%g,%g,%g,'%s',%d,%g,%g,%g,%g,%g,%g,'%s','%s','%s','%s','%s','%s')", tableName, el->id, el->fileId, el->sampleCount, el->basesInSample, el->sampleFileName, el->readCount, el->baseCount, el->readSizeMean, el->readSizeStd, el->readSizeMin, el->readSizeMax, el->qualMean, el->qualStd, el->qualMin, el->qualMax, el->qualType, el->qualZero, el->atRatio, el->aRatio, el->cRatio, el->gRatio, el->tRatio, el->nRatio, qualPosArray , aAtPosArray , cAtPosArray , gAtPosArray , tAtPosArray , nAtPosArray ); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); freez(&qualPosArray); freez(&aAtPosArray); freez(&cAtPosArray); freez(&gAtPosArray); freez(&tAtPosArray); freez(&nAtPosArray); } struct cdwFastqFile *cdwFastqFileLoad(char **row) /* Load a cdwFastqFile from row fetched with select * from cdwFastqFile * from database. Dispose of this with cdwFastqFileFree(). */ { struct cdwFastqFile *ret; AllocVar(ret); @@ -3567,35 +3567,35 @@ el = cdwBamFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwBamFileSaveToDb(struct sqlConnection *conn, struct cdwBamFile *el, char *tableName, int updateSize) /* Save cdwBamFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%d,%d,%lld,%lld,%lld,%lld,%g,%g,%d,%d,%d,%d,%g,%lld,%u)", tableName, el->id, el->fileId, el->isPaired, el->isSortedByTarget, el->readCount, el->readBaseCount, el->mappedCount, el->uniqueMappedCount, el->readSizeMean, el->readSizeStd, el->readSizeMin, el->readSizeMax, el->u4mReadCount, el->u4mUniquePos, el->u4mUniqueRatio, el->targetBaseCount, el->targetSeqCount); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwBamFile *cdwBamFileLoad(char **row) /* Load a cdwBamFile from row fetched with select * from cdwBamFile * from database. Dispose of this with cdwBamFileFree(). */ { struct cdwBamFile *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->isPaired = sqlSigned(row[2]); ret->isSortedByTarget = sqlSigned(row[3]); ret->readCount = sqlLongLong(row[4]); ret->readBaseCount = sqlLongLong(row[5]); @@ -3793,35 +3793,35 @@ el = cdwVcfFileLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwVcfFileSaveToDb(struct sqlConnection *conn, struct cdwVcfFile *el, char *tableName, int updateSize) /* Save cdwVcfFile 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%d,%d,%d,%lld,%d,%lld,%g,%lld,%g,%lld,%lld,%d,%d,%d,%lld,%g,%lld,%g,%d,%g,%g,%g,%g)", tableName, el->id, el->fileId, el->vcfMajorVersion, el->vcfMinorVersion, el->genotypeCount, el->itemCount, el->chromsHit, el->passItemCount, el->passRatio, el->snpItemCount, el->snpRatio, el->sumOfSizes, el->basesCovered, el->xBasesCovered, el->yBasesCovered, el->mBasesCovered, el->haploidCount, el->haploidRatio, el->phasedCount, el->phasedRatio, el->gotDepth, el->depthMin, el->depthMean, el->depthMax, el->depthStd); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwVcfFile *cdwVcfFileLoad(char **row) /* Load a cdwVcfFile from row fetched with select * from cdwVcfFile * from database. Dispose of this with cdwVcfFileFree(). */ { struct cdwVcfFile *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->vcfMajorVersion = sqlSigned(row[2]); ret->vcfMinorVersion = sqlSigned(row[3]); ret->genotypeCount = sqlSigned(row[4]); ret->itemCount = sqlLongLong(row[5]); @@ -4030,35 +4030,35 @@ el = cdwQaFailLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaFailSaveToDb(struct sqlConnection *conn, struct cdwQaFail *el, char *tableName, int updateSize) /* Save cdwQaFail 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,'%s')", tableName, el->id, el->fileId, el->qaVersion, el->reason); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaFail *cdwQaFailLoad(char **row) /* Load a cdwQaFail from row fetched with select * from cdwQaFail * from database. Dispose of this with cdwQaFailFree(). */ { struct cdwQaFail *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->qaVersion = sqlUnsigned(row[2]); ret->reason = cloneString(row[3]); return ret; } @@ -4187,35 +4187,35 @@ el = cdwQaEnrichTargetLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaEnrichTargetSaveToDb(struct sqlConnection *conn, struct cdwQaEnrichTarget *el, char *tableName, int updateSize) /* Save cdwQaEnrichTarget 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,'%s',%u,%lld)", tableName, el->id, el->assemblyId, el->name, el->fileId, el->targetSize); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaEnrichTarget *cdwQaEnrichTargetLoad(char **row) /* Load a cdwQaEnrichTarget from row fetched with select * from cdwQaEnrichTarget * from database. Dispose of this with cdwQaEnrichTargetFree(). */ { struct cdwQaEnrichTarget *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->assemblyId = sqlUnsigned(row[1]); ret->name = cloneString(row[2]); ret->fileId = sqlUnsigned(row[3]); ret->targetSize = sqlLongLong(row[4]); return ret; @@ -4351,35 +4351,35 @@ el = cdwQaEnrichLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaEnrichSaveToDb(struct sqlConnection *conn, struct cdwQaEnrich *el, char *tableName, int updateSize) /* Save cdwQaEnrich 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%lld,%lld,%g,%g,%g)", tableName, el->id, el->fileId, el->qaEnrichTargetId, el->targetBaseHits, el->targetUniqHits, el->coverage, el->enrichment, el->uniqEnrich); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaEnrich *cdwQaEnrichLoad(char **row) /* Load a cdwQaEnrich from row fetched with select * from cdwQaEnrich * from database. Dispose of this with cdwQaEnrichFree(). */ { struct cdwQaEnrich *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->qaEnrichTargetId = sqlUnsigned(row[2]); ret->targetBaseHits = sqlLongLong(row[3]); ret->targetUniqHits = sqlLongLong(row[4]); ret->coverage = sqlDouble(row[5]); @@ -4518,35 +4518,35 @@ el = cdwQaContamTargetLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaContamTargetSaveToDb(struct sqlConnection *conn, struct cdwQaContamTarget *el, char *tableName, int updateSize) /* Save cdwQaContamTarget 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u)", tableName, el->id, el->assemblyId); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaContamTarget *cdwQaContamTargetLoad(char **row) /* Load a cdwQaContamTarget from row fetched with select * from cdwQaContamTarget * from database. Dispose of this with cdwQaContamTargetFree(). */ { struct cdwQaContamTarget *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->assemblyId = sqlUnsigned(row[1]); return ret; } struct cdwQaContamTarget *cdwQaContamTargetLoadAll(char *fileName) @@ -4663,35 +4663,35 @@ el = cdwQaContamLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaContamSaveToDb(struct sqlConnection *conn, struct cdwQaContam *el, char *tableName, int updateSize) /* Save cdwQaContam 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%g)", tableName, el->id, el->fileId, el->qaContamTargetId, el->mapRatio); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaContam *cdwQaContamLoad(char **row) /* Load a cdwQaContam from row fetched with select * from cdwQaContam * from database. Dispose of this with cdwQaContamFree(). */ { struct cdwQaContam *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->qaContamTargetId = sqlUnsigned(row[2]); ret->mapRatio = sqlDouble(row[3]); return ret; } @@ -4816,35 +4816,35 @@ el = cdwQaRepeatLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaRepeatSaveToDb(struct sqlConnection *conn, struct cdwQaRepeat *el, char *tableName, int updateSize) /* Save cdwQaRepeat 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,'%s',%g)", tableName, el->id, el->fileId, el->repeatClass, el->mapRatio); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaRepeat *cdwQaRepeatLoad(char **row) /* Load a cdwQaRepeat from row fetched with select * from cdwQaRepeat * from database. Dispose of this with cdwQaRepeatFree(). */ { struct cdwQaRepeat *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->repeatClass = cloneString(row[2]); ret->mapRatio = sqlDouble(row[3]); return ret; } @@ -4975,35 +4975,35 @@ el = cdwQaPairSampleOverlapLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaPairSampleOverlapSaveToDb(struct sqlConnection *conn, struct cdwQaPairSampleOverlap *el, char *tableName, int updateSize) /* Save cdwQaPairSampleOverlap 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%lld,%lld,%lld,%g)", tableName, el->id, el->elderFileId, el->youngerFileId, el->elderSampleBases, el->youngerSampleBases, el->sampleOverlapBases, el->sampleSampleEnrichment); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaPairSampleOverlap *cdwQaPairSampleOverlapLoad(char **row) /* Load a cdwQaPairSampleOverlap from row fetched with select * from cdwQaPairSampleOverlap * from database. Dispose of this with cdwQaPairSampleOverlapFree(). */ { struct cdwQaPairSampleOverlap *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->elderFileId = sqlUnsigned(row[1]); ret->youngerFileId = sqlUnsigned(row[2]); ret->elderSampleBases = sqlLongLong(row[3]); ret->youngerSampleBases = sqlLongLong(row[4]); ret->sampleOverlapBases = sqlLongLong(row[5]); @@ -5142,35 +5142,35 @@ el = cdwQaPairCorrelationLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaPairCorrelationSaveToDb(struct sqlConnection *conn, struct cdwQaPairCorrelation *el, char *tableName, int updateSize) /* Save cdwQaPairCorrelation 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%g,%g,%g)", tableName, el->id, el->elderFileId, el->youngerFileId, el->pearsonInEnriched, el->pearsonOverall, el->pearsonClipped); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaPairCorrelation *cdwQaPairCorrelationLoad(char **row) /* Load a cdwQaPairCorrelation from row fetched with select * from cdwQaPairCorrelation * from database. Dispose of this with cdwQaPairCorrelationFree(). */ { struct cdwQaPairCorrelation *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->elderFileId = sqlUnsigned(row[1]); ret->youngerFileId = sqlUnsigned(row[2]); ret->pearsonInEnriched = sqlDouble(row[3]); ret->pearsonOverall = sqlDouble(row[4]); ret->pearsonClipped = sqlDouble(row[5]); @@ -5308,35 +5308,35 @@ el = cdwQaPairedEndFastqLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaPairedEndFastqSaveToDb(struct sqlConnection *conn, struct cdwQaPairedEndFastq *el, char *tableName, int updateSize) /* Save cdwQaPairedEndFastq 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%g,%g,%g,%g,%g,%d)", tableName, el->id, el->fileId1, el->fileId2, el->concordance, el->distanceMean, el->distanceStd, el->distanceMin, el->distanceMax, el->recordComplete); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaPairedEndFastq *cdwQaPairedEndFastqLoad(char **row) /* Load a cdwQaPairedEndFastq from row fetched with select * from cdwQaPairedEndFastq * from database. Dispose of this with cdwQaPairedEndFastqFree(). */ { struct cdwQaPairedEndFastq *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId1 = sqlUnsigned(row[1]); ret->fileId2 = sqlUnsigned(row[2]); ret->concordance = sqlDouble(row[3]); ret->distanceMean = sqlDouble(row[4]); ret->distanceStd = sqlDouble(row[5]); @@ -5486,35 +5486,35 @@ el = cdwQaWigSpotLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaWigSpotSaveToDb(struct sqlConnection *conn, struct cdwQaWigSpot *el, char *tableName, int updateSize) /* Save cdwQaWigSpot 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%g,%g,%lld,%lld,%g,%g)", tableName, el->id, el->wigId, el->spotId, el->spotRatio, el->enrichment, el->basesInGenome, el->basesInSpots, el->sumSignal, el->spotSumSignal); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaWigSpot *cdwQaWigSpotLoad(char **row) /* Load a cdwQaWigSpot from row fetched with select * from cdwQaWigSpot * from database. Dispose of this with cdwQaWigSpotFree(). */ { struct cdwQaWigSpot *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->wigId = sqlUnsigned(row[1]); ret->spotId = sqlUnsigned(row[2]); ret->spotRatio = sqlDouble(row[3]); ret->enrichment = sqlDouble(row[4]); ret->basesInGenome = sqlLongLong(row[5]); @@ -5673,35 +5673,35 @@ el = cdwQaDnaseSingleStats5mLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwQaDnaseSingleStats5mSaveToDb(struct sqlConnection *conn, struct cdwQaDnaseSingleStats5m *el, char *tableName, int updateSize) /* Save cdwQaDnaseSingleStats5m 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,%u,%g,%g,%lld,%lld,%g,%g,'%s','%s',%d,%g,%d,%g,%g,%g,%d)", tableName, el->id, el->fileId, el->sampleReads, el->spotRatio, el->enrichment, el->basesInGenome, el->basesInSpots, el->sumSignal, el->spotSumSignal, el->estFragLength, el->corrEstFragLen, el->phantomPeak, el->corrPhantomPeak, el->argMinCorr, el->minCorr, el->nsc, el->rsc, el->rscQualityTag); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwQaDnaseSingleStats5m *cdwQaDnaseSingleStats5mLoad(char **row) /* Load a cdwQaDnaseSingleStats5m from row fetched with select * from cdwQaDnaseSingleStats5m * from database. Dispose of this with cdwQaDnaseSingleStats5mFree(). */ { struct cdwQaDnaseSingleStats5m *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->sampleReads = sqlUnsigned(row[2]); ret->spotRatio = sqlDouble(row[3]); ret->enrichment = sqlDouble(row[4]); ret->basesInGenome = sqlLongLong(row[5]); @@ -5892,35 +5892,35 @@ el = cdwJobLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwJobSaveToDb(struct sqlConnection *conn, struct cdwJob *el, char *tableName, int updateSize) /* Save cdwJob 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%lld,%lld,'%s',%d,%d,%d)", tableName, el->id, el->commandLine, el->startTime, el->endTime, el->stderr, el->returnCode, el->pid, el->submitId); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwJob *cdwJobLoad(char **row) /* Load a cdwJob from row fetched with select * from cdwJob * from database. Dispose of this with cdwJobFree(). */ { struct cdwJob *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->commandLine = cloneString(row[1]); ret->startTime = sqlLongLong(row[2]); ret->endTime = sqlLongLong(row[3]); ret->stderr = cloneString(row[4]); ret->returnCode = sqlSigned(row[5]); @@ -6069,35 +6069,35 @@ el = cdwTrackVizLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwTrackVizSaveToDb(struct sqlConnection *conn, struct cdwTrackViz *el, char *tableName, int updateSize) /* Save cdwTrackViz 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,%u,'%s','%s','%s','%s')", tableName, el->id, el->fileId, el->shortLabel, el->longLabel, el->type, el->bigDataFile); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwTrackViz *cdwTrackVizLoad(char **row) /* Load a cdwTrackViz from row fetched with select * from cdwTrackViz * from database. Dispose of this with cdwTrackVizFree(). */ { struct cdwTrackViz *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->fileId = sqlUnsigned(row[1]); ret->shortLabel = cloneString(row[2]); ret->longLabel = cloneString(row[3]); ret->type = cloneString(row[4]); ret->bigDataFile = cloneString(row[5]); @@ -6246,35 +6246,35 @@ el = cdwDatasetLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwDatasetSaveToDb(struct sqlConnection *conn, struct cdwDataset *el, char *tableName, int updateSize) /* Save cdwDataset 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s','%s','%s','%s')", tableName, el->id, el->name, el->label, el->description, el->pmid, el->pmcid, el->metaDivTags, el->metaLabelTags); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwDataset *cdwDatasetLoad(char **row) /* Load a cdwDataset from row fetched with select * from cdwDataset * from database. Dispose of this with cdwDatasetFree(). */ { struct cdwDataset *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->label = cloneString(row[2]); ret->description = cloneString(row[3]); ret->pmid = cloneString(row[4]); ret->pmcid = cloneString(row[5]); @@ -6438,35 +6438,35 @@ el = cdwJointDatasetLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void cdwJointDatasetSaveToDb(struct sqlConnection *conn, struct cdwJointDataset *el, char *tableName, int updateSize) /* Save cdwJointDataset 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. This function automatically escapes quoted strings for mysql. */ { -struct dyString *update = newDyString(updateSize); +struct dyString *update = dyStringNew(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s','%s','%s','%s','%s')", tableName, el->id, el->name, el->label, el->description, el->childrenNames, el->metaDivTags); sqlUpdate(conn, update->string); -freeDyString(&update); +dyStringFree(&update); } struct cdwJointDataset *cdwJointDatasetLoad(char **row) /* Load a cdwJointDataset from row fetched with select * from cdwJointDataset * from database. Dispose of this with cdwJointDatasetFree(). */ { struct cdwJointDataset *ret; AllocVar(ret); ret->id = sqlUnsigned(row[0]); ret->name = cloneString(row[1]); ret->label = cloneString(row[2]); ret->description = cloneString(row[3]); ret->childrenNames = cloneString(row[4]); ret->metaDivTags = cloneString(row[5]);