Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
List of indexes
Message
De
14/06/2009 05:14:55
 
 
À
11/06/2009 17:02:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
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:
01405806
Vues:
42
>>>>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
>>
>>Cetin:
>>
>>Very elegant, but wouldn't ataginfo() be easier, as Naomi points out?
>
>When I originally wrote this ataginfo() was not available as I remember. I don't know if ataginfo() is nay better. Might be.
>Cetin

Thanks!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform