* provided lnSize1 and lnSize2 are equal if !llorder then =asort(Aflds1,1) && sort on column name =asort(Aflds2,1) && sort on column name else * order matters so don't sort the arrays endif llMatch = .T. for lxx = 1 to lnSize1 for lyy = 1 to 16 if Aflds1(lxx,lyy) # AFlds2(lxx,lyy) then llMatch = .F. exit endif endfor if !llMatch then exit endif endfor return llMatchCan you find any bugs with it?
FUNCTION DupStructs > * Determines if two table structures are equal > > LPARAMETERS tcAlias1, tcAlias2 > > LOCAL llresult, lnsize1, lnsize2, aflds1, aflds2, lni,; > lcexact, lnpt > lcexact = SET('EXACT') > DIMENSION aflds1[1], aflds2[1] > SET EXACT ON > lnsize1 = AFIELDS(aflds1, tcAlias1) > lnsize2 = AFIELDS(aflds2, tcAlias2) > * Are there the same number of fields? > llresult = (lnsize1 = lnsize2) > IF llresult > lni = 0 > DO WHILE lni < lnsize1 AND llresult > lni = lni + 1 > lnpt = ASCAN(aflds2, aflds1[lni, 1]) > * Does the field exist? > llresult = (lnpt > 0) > IF llresult > * Yes it does > lnpt = ASUBSCRIPT(aflds2, lnpt, 1) > * Are the data types, field sizes, and decimals equal? > llresult = (aflds1[lni, 2] = aflds2[lnpt, 2] AND; > aflds1[lni, 3] = aflds2[lnpt, 3] AND; > aflds1[lni, 4] = aflds2[lnpt, 4]) > ENDIF > ENDDO > ENDIF > SET EXACT &lcexact > RETURN llresult >ENDFUNC