1dfa3b9f97577f088af82ed02340c07886d690fd galt Fri Oct 7 16:52:26 2022 -0700 Various bugfixes for sqlSafef v2 and some of Jims refactoring like adding fuseCsvFields so it can support multiple tables in the from list. Also fixed an encoding issue for sample labels that had a double-quote in them. Updated jquery.min.js to point to newer version 1.12. diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c index 040b69b..99bacfd 100644 --- src/hg/lib/jksql.c +++ src/hg/lib/jksql.c @@ -1841,30 +1841,48 @@ char tableName[1024]; sqlParseDbDotTable(connDb, table, tableDb, sizeof tableDb, tableName, sizeof tableName); char query[1024]; sqlSafef(query, 1024, "SHOW COLUMNS FROM `%s` LIKE '%s'", tableName, column); boolean changeDb = differentStringNullOk(connDb, tableDb); if (changeDb) sqlConnChangeDbMainOrFailover(conn, tableDb, TRUE); char buf[1024]; char *ret = sqlQuickQuery(conn, query, buf, 1024); if (changeDb) sqlConnChangeDbMainOrFailover(conn, connDb, TRUE); freeMem(connDb); return (ret!=NULL); } +boolean sqlColumnExistsInTablesList(struct sqlConnection *conn, char *tables, char *field) +/* check if column exists in a list of tables */ +{ +boolean result = FALSE; +struct slName *tablesList = slNameListFromComma(tables); +struct slName *table; +for(table = tablesList; table; table = table->next) + { + if (sqlColumnExists(conn, table->name, field)) + { + result = TRUE; + break; + } + } +slFreeList(&tablesList); +return result; +} + int sqlTableSizeIfExists(struct sqlConnection *sc, char *table) /* Return row count if a table exists, -1 if it doesn't. */ { char query[256]; struct sqlResult *sr; char **row = 0; int ret = 0; sqlSafef(query, sizeof(query), "select count(*) from %s", table); if ((sr = sqlUseOrStore(sc, query, DEFAULTGETTER, FALSE)) == NULL) return -1; row = sqlNextRow(sr); if (row != NULL && row[0] != NULL) ret = atoi(row[0]); sqlFreeResult(&sr);