d1e16597846fc15d4388fc0625ce265aec2cd490 hiram Tue Jul 2 16:02:00 2019 -0700 adding new list function to show schema for a table with row count refs #23739 diff --git src/hg/hubApi/dataApi.h src/hg/hubApi/dataApi.h index df5312b..0ead1fc 100644 --- src/hg/hubApi/dataApi.h +++ src/hg/hubApi/dataApi.h @@ -60,30 +60,31 @@ #define argTrack "track" #define argChrom "chrom" #define argStart "start" #define argEnd "end" #define argMaxItemsOutput "maxItemsOutput" #define argJsonOutputArrays "jsonOutputArrays" /* valid argument listings to verify extraneous arguments * initialized in hubApi.c */ extern char *argListPublicHubs[]; extern char *argListUcscGenomes[]; extern char *argListHubGenomes[]; extern char *argListTracks[]; extern char *argListChromosomes[]; +extern char *argListSchema[]; extern char *argGetDataTrack[]; extern char *argGetDataSequence[]; /* maximum number of words expected in PATH_INFO parsing * so far only using 2 */ #define MAX_PATH_INFO 32 /* maximum amount of DNA allowed in a get sequence request */ #define MAX_DNA_LENGTH 499999999 /* this size is directly related to the max limit in needMem used in * jsonWriteString */ extern long enteredMainTime; /* will become = clock1000() on entry */ @@ -137,31 +138,31 @@ struct jsonWrite *apiStartOutput(); /* begin json output with standard header information for all requests */ extern char *jsonTypeStrings[]; #define JSON_STRING 0 // "string", /* type 0 */ #define JSON_NUMBER 1 // "number", /* type 1 */ #define JSON_OBJECT 2 // "object", /* type 2 */ #define JSON_ARRAY 3 // "array", /* type 3 */ #define JSON_BOOLEAN 4 // "boolean", /* type 4 */ #define JSON_NULL 5 // "null" /* type 5 */ #define JSON_DOUBLE 6 // UCSC json type double /* type 6 */ int autoSqlToJsonType(char *asType); /* convert an autoSql field type to a Json type */ -int tableColumns(struct sqlConnection *conn, struct jsonWrite *jw, char *table, +int tableColumns(struct sqlConnection *conn, char *table, char ***nameReturn, char ***typeReturn, int **jsonTypes); /* return the column names, the MySQL data type, and json data type * for the given table return number of columns (aka 'fields') */ struct trackHub *errCatchTrackHubOpen(char *hubUrl); /* use errCatch around a trackHub open in case it fails */ struct trackDb *obtainTdb(struct trackHubGenome *genome, char *db); /* return a full trackDb fiven the hub genome pointer, or ucsc database name */ struct trackDb *findTrackDb(char *track, struct trackDb *tdb); /* search tdb structure for specific track, recursion on subtracks */ struct bbiFile *bigFileOpen(char *trackType, char *bigDataUrl); @@ -179,28 +180,41 @@ struct asObject *asForTable(struct sqlConnection *conn, char *table, struct trackDb *tdb); /* Get autoSQL description if any associated with table. */ /* Wrap some error catching around asForTable. */ struct trackHubGenome *findHubGenome(struct trackHub *hub, char *genome, char *endpoint, char *hubUrl); /* given open 'hub', find the specified 'genome' called from 'endpoint' */ struct dbDb *ucscDbDb(); /* return the dbDb table as an slList */ boolean isSupportedType(char *type); /* is given type in the supportedTypes list ? */ +void wigColumnTypes(struct jsonWrite *jw); +/* output column headers for a wiggle data output schema */ + +void outputSchema(struct trackDb *tdb, struct jsonWrite *jw, + char *columnNames[], char *columnTypes[], int jsonTypes[], + struct hTableInfo *hti, int columnCount, int asColumnCount, + struct asColumn *columnEl); +/* print out the SQL schema for this trackDb */ + +void bigColumnTypes(struct jsonWrite *jw, struct sqlFieldType *fiList, + struct asObject *as); +/* show the column types from a big file autoSql definitions */ + /* ######################################################################### */ /* functions in getData.c */ void apiGetData(char *words[MAX_PATH_INFO]); /* 'getData' function, words[1] is the subCommand */ /* ######################################################################### */ /* functions in list.c */ void apiList(char *words[MAX_PATH_INFO]); /* 'list' function words[1] is the subCommand */ #endif /* DATAAPH_H */