Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Codebook Tip - Integer Primary Keys
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Divers
Thread ID:
00047514
Message ID:
00047528
Vues:
21
Kevin,

I remember this as Mac Rubel's never ending article!

I have come to call him "Stretch Rubel" for the way he dragged that one out. You would think he had some consulting contract at a bank, the way he took a simple article and spread it across about four issues (and still said only the barest after all!).

Cheers,
Jim N

>All,
>
>We have made a change to our Codebook for Mere Mortals framework that will be included in the next release (Version 2.07 available in the next few weeks) that is also useful for all Codebook developers.
>
>By default, Codebook generates character-type primary keys for tables. But with a slight change you can also generate integer primary keys. If you are unfamiliar with the beauty of integer keys (speed and reduced file size), check out Mac Rubel's article "Real Programmers Use Integers" in the May '97 issue of FoxPro Advisor.
>
>Here's a list of the necessary changes:
>
>1. In your database container, modify the stored procedure NewID(). At the bottom of the procedure, change the following code:
>
>Change...
>RETURN TRIM(luID)
>
>To...
>IF id.Type = 'C'
> RETURN TRIM(luID)
>ELSE
> RETURN luID
>ENDIF
>
>2. Edit ID.dbf properties and change the size of the "Value" field from Char 6 to Char 11.
>
>3. When you add a record for the table to ID.dbf, specify the IncrementProcedure as: IncrementBase10(LEFT(id.value,id.maxlength)) and specify the Type as "I".
>
>4. When you want a table to have an integer primary key, just specify the "iID" primary key field as Integer.
>
>If you make this change to the Generic.dbc (as we have done) all newly generated applications will inherit the ability to generate both character and integer primary keys.
>
>Regards,
>Kevin McNeish
>Oak Leaf Enterprises Solution Design, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform