Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SDT and the ID table
Message
From
03/07/1999 10:52:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
SDT and the ID table
Miscellaneous
Thread ID:
00237182
Message ID:
00237182
Views:
50
Anybody who does development knows how valuable Stonefield Database Toolkit can be. In my environment, I bang out an application in just a couple of hours and let my users have access to it. Invariably they have requests for changes. I make changes in my development database and then roll them out into my production database using SDT.

The problem is the ID table. Unless I open the production database ID table and put any new values there, the users won't have access to the NewID() functionlity for any new tables that were added during the update process.

What I have done to handle this problem is output a text file from my development id table and distribute it with my new dbc and the Stonefield metadata components. I modified the cStonefield class to include two new properties and a new funtion--lGetIdValues, cIdText and GetIdValues().

I then modified the init code:
*------------------------------------------------
*--- If specified to do so, check file structures
*------------------------------------------------
IF This.lStartupCheck AND ;
This.Parent.oMeta.oSDTMgr.OpenData(This.cDELoader.oDataEnvironment.cDefaultDatabase,.T.)
If This.Parent.oMeta.oSDTMgr.NeedUpdate()
This.Parent.oMeta.oSDTMgr.Update()
IF This.lGetIdValues
This.GetIdValues()
ENDIF
ENDIF
ENDIF

The funtion that adds the new values:
* Program...........: CSTONEFIELD.GETIDVALUES
* Author............: James M. Weil
* Project...........: Count Basie Mailing List Manager
* Created...........: 07/02/99 22:15:38
* Copyright.........: (c) DataDesign Solutions, Inc., 1999
*) Description.......:
* Calling Samples...:
* Parameter List....:
* Major change list.:

LOCAL lcPath, lcIdFile

lcPath = justpath(This.cDELoader.oDataEnvironment.cDefaultDatabase)
lcIdFile = lcPath+'\'+This.cIdText

If File(lcIdFile)
*-----------------------------------------------------------
*-- Attempt to open the id table exclusively
*-----------------------------------------------------------

If This.Parent.oMeta.oSDTMgr.OpenTable('id', 'PRIMARY', .T.)

*-----------------------------------------------------------
*-- Create a temporary cursor from the id table
*-----------------------------------------------------------
=AFIELDS(laTemp,'id')
Create Cursor tmpCursor FROM ARRAY laTemp
Append from &lcIdFile Type sdf

*-------------------------------------------------------
*-- Insert any new values into the id table
*-------------------------------------------------------
Scan
If !SEEK(tmpCursor.keyname, 'id', 'keyname')
Scatter MEMVAR
INSERT INTO id FROM MEMVAR
Endif
Endscan
Use IN tmpCursor
Use in id

*-----------------------------------------------------------
*-- Cleanup so we don't trash our Id file everytime we update
*-----------------------------------------------------------
Erase &lcIdFile
Endif
Endif
Next
Reply
Map
View

Click here to load this message in the networking platform