d6690c5c304e3b0cf43f8199abb8fd08ad32a6e6 kent Fri Feb 20 15:30:52 2015 -0800 Added functions to get all fields associated with a sqlResult as a slName list or as an array of char *'s. diff --git src/hg/inc/jksql.h src/hg/inc/jksql.h index af79525..f6632c2 100644 --- src/hg/inc/jksql.h +++ src/hg/inc/jksql.h @@ -362,32 +362,39 @@ boolean sqlMaybeMakeTable(struct sqlConnection *sc, char *table, char *query); /* Create table from query if it doesn't exist already. * Returns FALSE if didn't make table. */ void sqlRemakeTable(struct sqlConnection *sc, char *table, char *create); /* Drop table if it exists, and recreate it. */ char **sqlNextRow(struct sqlResult *sr); /* Fetch next row from result. If you need to save these strings * past the next call to sqlNextRow you must copy them elsewhere. * It is ok to write to the strings - replacing tabs with zeroes * for instance. You can call this with a NULL sqlResult. It * will then return a NULL row. */ char* sqlFieldName(struct sqlResult *sr); -/* repeated calls to this function returns the names of the fields - * the given result */ +/* Repeated calls to this function returns the names of the fields + * the given result. */ + +struct slName *sqlResultFieldList(struct sqlResult *sr); +/* Return slName list of all fields in query. Can just be done once per query. */ + +int sqlResultFieldArray(struct sqlResult *sr, char ***retArray); +/* Get the fields of sqlResult, returning count, and the results + * themselves in *retArray. */ int sqlFieldColumn(struct sqlResult *sr, char *colName); /* get the column number of the specified field in the result, or * -1 if the result doesn't contailed the field.*/ int sqlTableSize(struct sqlConnection *conn, char *table); /* Find number of rows in table. */ int sqlFieldIndex(struct sqlConnection *conn, char *table, char *field); /* Returns index of field in a row from table, or -1 if it * doesn't exist. */ struct slName *sqlFieldNames(struct sqlConnection *conn, char *table); /* Returns field names from a table. */