89ffe44594827b78d52631db205983d17f5074e5 kent Tue Apr 17 12:14:48 2012 -0700 Adding asColumnFind function. diff --git src/lib/asParse.c src/lib/asParse.c index 0505d4a..e87ffa8 100644 --- src/lib/asParse.c +++ src/lib/asParse.c @@ -405,30 +405,41 @@ { return asParseLineFile(lineFileOpen(fileName, TRUE)); } struct asObject *asParseText(char *text) /* Parse autoSql from text (as opposed to file). */ { char *dupe = cloneString(text); struct lineFile *lf = lineFileOnString("text", TRUE, dupe); struct asObject *objList = asParseLineFile(lf); freez(&dupe); return objList; } +struct asColumn *asColumnFind(struct asObject *as, char *name) +/* Return column of given name from object, or NULL if not found. */ +{ +struct asColumn *col; +for (col = as->columnList; col != NULL; col = col->next) + { + if (sameString(col->name, name)) + return col; + } +return NULL; +} boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck, int *retNumColumnsSame, boolean abortOnDifference) /* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type. * If difference found, print it to stderr. If abortOnDifference, errAbort. * Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields. * If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */ { boolean differencesFound = FALSE; struct asColumn *col1 = as1->columnList, *col2 = as2->columnList; int checkCount = 0; int verboseLevel = 2; if (abortOnDifference) verboseLevel = 1; if (as1->isTable != as2->isTable)