Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing
Message
 
À
31/07/2001 07:29:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00537681
Message ID:
00537697
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
Hi!
Here a fragment of my old code:
LPARAMETERS lcDBF1, lcDBF2
LOCAL laDBF1(1), laDBF2(1), lnFields1, lnFields2
LOCAL i, j, lcField, lVal1, lVal2

* Input parameters checking
IF PCOUNT() < 2
   = MESSAGEBOX('Input files not defined!', 16, 'Tables comparing')
   RETURN .F.
ENDIF
lcDBF1 = DEFAULTEXT(lcDBF1, 'dbf')
lcDBF2 = DEFAULTEXT(lcDBF2, 'dbf')
IF !FILE(lcDBF1)
   = MESSAGEBOX('File '+lcDBF1+' not found!', 16, 'Tables comparing')
   RETURN .F.
ENDIF
IF !FILE(lcDBF2)
   = MESSAGEBOX('File '+lcDBF2+' not found!', 16, 'Tables comparing')
   RETURN .F.
ENDIF

* Tables structure comparing
USE (lcDBF1) IN 0 ALIAS DBF1
USE (lcDBF2) IN 0 ALIAS DBF2
lnFields1 = AFIELDS(laDBF1, 'DBF1')
lnFields2 = AFIELDS(laDBF2, 'DBF2')
IF lnFields1 != lnFields2
   = MESSAGEBOX('Fields number is different!', 16, 'Tables comparing')
   USE IN DBF1
   USE IN DBF2
   RETURN .F.
ENDIF
FOR i = 1 TO lnFields
   FOR j = 1 TO 4
      IF laDBF1(i, j) != laDBF2(i, j)
         = MESSAGEBOX('Table structures are different!', 16, 'Tables comparing')
         USE IN DBF1
         USE IN DBF2
         RETURN .F.
      ENDIF
   ENDFOR
ENDFOR
>Can anyone tell me how i can programmatically compare two table structures to ensure that they are the exact same...?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform