2f0d3fa3d2bcbf3e23e834ca68565c470f73939d chmalee Mon Oct 21 12:32:08 2024 -0700 Back end for auto-generating a hub with every user upload done diff --git src/hg/lib/hubSpace.c src/hg/lib/hubSpace.c index 17da83e..de82458 100644 --- src/hg/lib/hubSpace.c +++ src/hg/lib/hubSpace.c @@ -1,27 +1,25 @@ /* hubSpace.c was originally generated by the autoSql program, which also * generated hubSpace.h and hubSpace.sql. This module links the database and * the RAM representation of objects. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "hubSpace.h" - - char *hubSpaceCommaSepFieldNames = "userName,fileName,fileSize,fileType,creationTime,lastModified,hubNameList,db,location,md5sum"; void hubSpaceStaticLoad(char **row, struct hubSpace *ret) /* Load a row from hubSpace table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->userName = row[0]; ret->fileName = row[1]; ret->fileSize = sqlLongLong(row[2]); ret->fileType = row[3]; ret->creationTime = row[4]; ret->lastModified = row[5]; ret->hubNameList = row[6]; ret->db = row[7]; @@ -47,32 +45,32 @@ slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void hubSpaceSaveToDb(struct sqlConnection *conn, struct hubSpace *el, char *tableName, int updateSize) /* Save hubSpace 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 = dyStringNew(updateSize); -sqlDyStringPrintf(update, "insert into %s values ( '%s','%s',%lld,'%s','%s','%s','%s','%s','%s','%s')", - tableName, el->userName, el->fileName, el->fileSize, el->fileType, el->creationTime, el->lastModified, el->hubNameList, el->db, el->location, el->md5sum); +sqlDyStringPrintf(update, "insert into %s values ( '%s','%s',%lld,'%s',NULL,'%s','%s','%s','%s','%s')", + tableName, el->userName, el->fileName, el->fileSize, el->fileType, el->lastModified, el->hubNameList, el->db, el->location, el->md5sum); sqlUpdate(conn, update->string); dyStringFree(&update); } struct hubSpace *hubSpaceLoad(char **row) /* Load a hubSpace from row fetched with select * from hubSpace * from database. Dispose of this with hubSpaceFree(). */ { struct hubSpace *ret; AllocVar(ret); ret->userName = cloneString(row[0]); ret->fileName = cloneString(row[1]); ret->fileSize = sqlLongLong(row[2]); ret->fileType = cloneString(row[3]);