Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating classlibraries that are in use
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Updating classlibraries that are in use
Divers
Thread ID:
00602963
Message ID:
00602963
Vues:
53
Hello Guys!,
I don't know if this is old news, but I found a way to update class libraries and reports without interrupting the users, I tried it and it works!, this is what I do, lets say that I made some changes to a class library, then I want to update the version being in use that resides in the network, I open the old and
new VCXs files as tables and update record by record from the new to the old one. here is a short vertion of the code :

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Method Name : UpdTable *
* Description : Update a class, report or any table with data from *
* another table of the same structure,
* it compares the two table record *
* by record, and update from the source *
* Parameters : tcFromTableName : Character, name of the source table
* tcToTableName : Character, name of the table to be
* Return : Numeric : 0 means sucesfull
* Author : Luis Guzman 01/07/2002
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

LPARAMETER tcFromTableName,;
tcToTableName

* When I say table read "VCX" or "FRX" file of a class library
* or report

LOCAL lcOldSetDeleted,;
lnRowCounter,;
lcCommand,;
lnlnTotalRecords,;
lnCurrentRecord

lcOldSetDeleted=SET("DELETED")
tcFromTableName=ALLTRIM(UPPER(tcFromTableName))

SET DELETED OFF
SELECT EVAL("tcFromTableName")

lnTotalRecords=RECCOUNT(tcToTableName)

DO WHILE NOT EOF()

llIsDeleted=DELETED() && Check if the record is deleted
lnCurrentRecord=RECNO() && Save the current record number

SCATTER MEMVAR MEMO && Load into memory all the
&& information for that record

IF lnCurrentRecord>lnTotalRecords && a new record, insert
&& a row

INSERT INTO &tcToTableName FROM MEMVAR
SELECT (tcFromTableName)
SKIP
LOOP
ENDIF

SELECT (tcToTableName)
GO RECORD lnCurrentRecord && Go to the matching record
&& number
GATHER MEMVAR MEMO

IF llIsDeleted && If the record is deleted in the
&& source, delete tha record from
DELETE && the second table
ELSE
RECALL
ENDIF

SELECT (tcFromTableName)
SKIP

ENDDO

SELECT (tcToTableName)
IF !EOF()
SKIP
ENDIF

DO WHILE !EOF() && Eliminate reminning records
DELETE
SELECT (tcToTableName)
SKIP
ENDDO

SET DELETE &lcOldSetDeleted

* Now you can compile the class library or report and your are ready to go

What do you think?, any comments?
Luis Guzman, MCP
"The only glory most of us have to hope for
is the glory of being normal." Katherine Fulleton Gerould
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform