Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Should I add DELETED() tag
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00507170
Message ID:
00507330
Vues:
34
>SNIP

>After making PRG I discovered that I had to make filters manually because there are no way to do
> this for primary key tags programmatically (you can read this in the comments inside of the gendbc tool). So, why
> messing with it?

Vlad,

I believe you can create filtered PRIMARY KEYs programmically with:

*
* Assumes an open DBC and DBF
*
lnTagCount = TAGCOUNT()
IF lnTagCount > 0
DIMENSION laTags[lnTagCount, 7]
FOR lnTag = 1 TO lnTagCount
laTags[lnTag, 1] = TAG(lnTag)
laTags[lnTag, 2] = KEY(lnTag)
laTags[lnTag, 3] = FOR(lnTag)
laTags[lnTag, 4] = UNIQUE(lnTag)
laTags[lnTag, 5] = PRIMARY(lnTag)
laTags[lnTag, 6] = CANDIDATE(lnTag)
laTags[lnTag, 7] = DESCENDING(lnTag)
ENDFOR

FOR lnTag = 1 TO lnTagCount
IF laTags[lnTag, 5] && Primary key
lcTag = "ALTER TABLE " + lcTableName + " ADD PRIMARY KEY " + laTags[lnTag, 2]
IF NOT EMPTY (laTags[lnTag, 3]) && Filter not empty
lcTag = lcTag + " FOR " + laTags[lnTag, 3]
ENDIF
lcTag = lcTag + " TAG " + laTags[lnTag, 1]
ELSE
*
*
*
ENDIF

&lcTag && Create the tag

*
* ALTER TABLE cTableName ADD PRIMARY KEY [FOR cFilterExpression] TAG cTagName
*
ENDFOR

GenDbc (and GenDbcx) may not extract the filters but it can be modified to get the information and write it out.

I am not sure where I picked it up.

Bob
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform