Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List of indexes
Message
De
11/06/2009 15:44:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
11/06/2009 15:08:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01405333
Message ID:
01405345
Vues:
63
>Hi All:
>
>Is there a way to return a array of indexes in an associated CDX for a given tables together with their respective keys?
>
>Thanks,
>
>Yossi
GetFieldsAndIndexes(_samples+'data')
Select crsStructs
Locate
Browse
Select crsINDEXES
Locate
Browse

Procedure GetFieldsAndIndexes(tcDataDir)
  tcDataDir = Addbs(m.tcDataDir)
  Create Cursor crsStructs ;
    (FIELD_NAME C(128) NoCPTrans, ;
    FIELD_TYPE C(1), ;
    FIELD_LEN N(3, 0), ;
    FIELD_DEC N(3, 0), ;
    FIELD_NULL L, ;
    FIELD_NOCP L, ;
    _TABLENAME M NoCPTrans)
  Create Cursor crsINDEXES ;
    (TAG_NAME C(10) NoCPTrans, ;
    KEY_EXPR M, ;
    NDXTYPE C(1), ;
    IS_DESC L, ;
    FILTEREXPR M NoCPTrans, ;
    _TABLENAME M NoCPTrans)
  Select 0
  lnTables = Adir(arrTables,m.tcDataDir+'*.dbf')
  For ix=1 To m.lnTables
    Use (m.tcDataDir+arrTables[m.ix,1])

    lnFields=Afields(arrStruc)
    For jx=1 To m.lnFields
      arrStruc[m.jx,7]=arrTables[m.ix,1]
    Endfor
    Insert Into crsStructs From Array arrStruc
    Release arrStruc
    If Tagcount()>0
      Dimension arrIndexes[tagcount(),6]
      For jx=1 To Tagcount()
        arrIndexes[m.jx,1] = Tag(m.jx)
        arrIndexes[m.jx,2] = Key(m.jx)
        arrIndexes[m.jx,3] = Iif(Primary(m.jx),'P',Iif(Candidate(m.jx),'C',Iif(Unique(m.jx),'U','R')))
        arrIndexes[m.jx,4] = Descending(m.jx)
        arrIndexes[m.jx,5] = Sys(2021,m.jx)
        arrIndexes[m.jx,6] = arrTables[m.ix,1]
      Endfor
      Insert Into crsINDEXES From Array arrIndexes
    Endif

    Use
  Endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform