Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update issues
Message
De
01/10/1999 19:26:17
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Stonefield
Titre:
Update issues
Divers
Thread ID:
00271814
Message ID:
00271814
Vues:
69
I am distributing a project to several offices which I plan to maintain and periodicly upgrade. Obviously, this will involve updates to the data dictonary from time to time. I want to implement a startup procedure to check the dictonary and if necessary update the files.

The priciple I used was to save the DateTime of the DBC/DBX files in a preferances table. Each time the program is run the value is compared to the current value of the files and if different NeedUpdate() is run which calls Update() to update any structural changes required.

The problem is that the DateTime values of the dictionary keep changing, setting off the updates. This causes about a 2 min. delay at startup and is unexceptable. If you go in and out several times in a short period everything is fine. If you are in for a period of time the whole thing fires off again.

The following is a listing of the code in use.

*********************************************************************************
****** ******
****** Determines if database structure/index changes were made. ******
****** If so update the files appropriately. ******
****** 1) Check the DBC & DBX modificattion date & times against ******
****** the values stored in the preferances table in two ******
****** "Hidden" (not on any maintenance forms) fields. ******
****** 2) If there are any differances, run the Stonefield ******
****** NeedUpdate method to determine if any changes effecting ******
****** structures, indexes, or views are needed. If so the ******
****** Update method is run to effect the changes. ******
****** 3) If an update was performed the current DBC DBX ******
****** the new date time stamps are stored in the preferances ******
****** table. ******
****** ******
*********************************************************************************
LOCAL ltDBCDateTime, ltDBCCheck, ltDCTDateTime, ltDCTCheck, ;
llOpenedPreferances, llUpdatedSystem, lcAlias, lnDatasessionID
* Get Main file modification dates
ltDBCDateTime = FDATE("DATABASES\MAIN.DBC", 1)
ltDCTDateTime = FDATE("DATABASES\MAIN.DCT", 1)
* Set flags to default
llOpenedPreferances = .F.
llUpdatedSystem = .F.
lcAlias = ALIAS()
SET DATASESSION TO 1
IF !USED("Preferances")
llOpenedPreferances = .T.
SELECT SELECT(1)
USE Preferances
ELSE
SELECT Preferances
ENDIF
ltDBCCheck = Preferances.DBCCheck
ltDCTCheck = Preferances.DCTCheck

IF ltDBCDateTime <> ltDBCCheck .OR. ltDCTDateTime <> ltDCTCheck
* llOpenedPreferances can be set to .F. here as code below will close it
llOpenedPreferances = .F.

*********************************************************************************
****** Check to see if system needs to be updated.
*********************************************************************************
OPEN DATABASE DATABASES\MAIN

*private oMeta
oMeta = NEWOBJECT('DBCXMgr', 'DBCXMGR.VCX', '', .F., JustPath(dbc()))
IF TYPE('oMeta') <> 'O'
MESSAGEBOX(;
"SORRY! Was unable to setup the required" + CHR(13) +;
"database manager. Please tell the programmer." + CHR(13) +;
"The system will be shut down now.", 0+16+0)
RETURN
ENDIF <> O

oMeta.SetDatabase(dbc())

IF oMeta.oSDTMgr.NeedUpdate()
oMeta.oSDTMgr.Update()
* Update the preferances table
SET DATASESSION TO 1
IF !USED("Preferances")
USE Main!Preferances
llOpenedPreferances = .T.
ENDIF
SELECT Preferances
REPLACE;
DBCCheck WITH FDATE("DATABASES\MAIN.DBC", 1), ;
DCTCheck WITH FDATE("DATABASES\MAIN.DCT", 1)
ENDIF needupdate


ENDIF datetime <>

IF !EMPTY(lcAlias)
* Return to original alias
SELECT &lcAlias
ELSE
SELECT 1
ENDIF empty

* Release preferances table if opened in this program
IF llOpenedPreferances
USE IN Preferances
ENDIF


Any suggestions as to how to get this to work properly would be greatly appreaciated.

Thanks Terry
It is impossible to make programs idiot proof. Idiots are too cleaver.

MCP( Tcp/Ip )
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform