Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wanting to move forward in my FoxPro experience...
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00112108
Message ID:
00112446
Views:
23
Another example of the keys table - NewID() stored procedure system can be found in TASTRADE.

>I'll take a shot at your non-philosophical questions. The first two have a lot of differrent answers and I'm sure you'll here a variety of opinions. ;)
>
>>3) I've heard a little about the concept of having a table that has no real >"live-data" holding purpose, but just to reference other table's keys (or >something like that)? Could anyone explain this concept a little more in >detail?
>I make use of one of these in all my apps. It's a pretty common way to insure all your tables in a multiuser environment have unique primary key generation.
>Basically you have a table (I always call mine setup) with one record for each of the tables in your database. One field holds the table name, the other is a field set up the same length and type of the primary key fields of all your tables. The number you store here is the "next" id, waiting for new records in each table. The code to lock this record and update each key is in the stored procedures of the database. In each table the default value of the primary key is set to getid('employees') (for the employees table) for example.
>(This would be in the stored procedures)
>PROCEDURE GETID
>PARAMETERS gettable
>** Gets the next id for each table
>LOCAL lcoldalias, lnreturn
>lnreturn=0 && to hold the new id
>lcoldalias=alias() && so we can return to the originally selected table
>USE setup ORDER tablename in 0 SHARED && open the setup table
>SELECT setup
>SEEK gettable && Look for the name of the table to be added to
>IF FOUND()
>LOCK() && Lock the record - set reprocess should allow others to get it &&after this is done
>lnreturn=nextid && Grab the id
>replace nextid with nextid+1 && Increment the id by one
>UNLOCK && Unlock the record
>ENDIF
>select setup
>use
>select (lcoldalias)
>RETURN lnreturn && Return the id from the setup table
>
>>4) Is there any way to get rid of the _screen object, and have just your own >top-level forms that you produced? I don't like the sloppy solution of just
>[snip]
>In the config.fpw place the following line:
>screen=off
>Then your screens will be the only thing to appear. This does complicate doing report previews a bit, you may have to do them in a window you define (since there is no screen, essentially).
>
>Hth!
>--
>Jerry Ritcey
>Lockeport, NS
Previous
Reply
Map
View

Click here to load this message in the networking platform