Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement