Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Table Structures
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00518332
Message ID:
00518374
Vues:
14
>George,
>A little tweak could be to add an ASORT() (if the position doesn't matter) and simply compare Aflds1 to Aflds2 for every element. The same comparison could be done without the ASort if the position matters.
>* 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 llMatch
>
>Can you find any bugs with it?

Larry,

Just looking at it...not really. I'd SET EXACT ON to be sure is one thing (which I'm sure you'd do, just didn't include here). I wouldn't necessarily compare all the elements. I mean I certainly wouldn't consider the tables different if the comments associated with the field were different. Would you?

As I said initially, the solution depends largely on how "the same" is defined. Given the loose typing of VFP, you could say that numeric fields with the same field name, but different data types were "the same" (floats and doubles, example).
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform