dd06af8866cf7caca22463089b2c78a6cfa60dee kent Sat Aug 31 18:26:33 2019 -0700 Adding -id and -startId options to fieldedTable to get steadily incrementing numerical id's for django. diff --git src/inc/fieldedTable.h src/inc/fieldedTable.h index 290c789..ac1d9e5 100644 --- src/inc/fieldedTable.h +++ src/inc/fieldedTable.h @@ -36,30 +36,35 @@ struct fieldedRow *fieldedTableAdd(struct fieldedTable *table, char **row, int rowSize, int id); /* Create a new row and add it to table. Return row. */ struct fieldedRow *fieldedTableAddHead(struct fieldedTable *table, char **row, int rowSize, int id); /* Create a new row and add it to start of table. Return row. */ struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *url, char *requiredFields[], int requiredCount); /* Read table from tab-separated file with a #header line that defines the fields. Ensures * all requiredFields (if any) are present. The url is just used for error reporting and * should be the same as fileName for most purposes. This is used by edwSubmit though which * first copies to a local file, and we want to report errors from the url. */ void fieldedTableToTabFile(struct fieldedTable *table, char *fileName); /* Write out a fielded table back to file */ +void fieldedTableToTabFileWithId(struct fieldedTable *table, char *fileName, + char *idField, int startId); +/* Write out a fielded table back to file. If idField is non-NULL it will be added + * to the start of each output line as a steadily incrementing integer starting with startId. */ + boolean fieldedTableColumnIsNumeric(struct fieldedTable *table, int fieldIx); /* Return TRUE if field has numeric values wherever non-null */ int fieldedTableMaxColChars(struct fieldedTable *table, int colIx); /* Calculate the maximum number of characters in a cell for a column */ void fieldedTableSortOnField(struct fieldedTable *table, char *field, boolean doReverse); /* Sort on field. Distinguishes between numerical and text fields appropriately. */ int fieldedTableMustFindFieldIx(struct fieldedTable *table, char *field); /* Find index of field in table's row. Abort if field not found. */ struct hash *fieldedTableIndex(struct fieldedTable *table, char *field); /* Return hash of fieldedRows keyed by values of given field */