Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running Loosely Connected & row rule recursion
Message
De
07/02/2005 07:25:46
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Running Loosely Connected & row rule recursion
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
00984403
Message ID:
00984403
Vues:
69
Hi,

I've taken some ideas from a July 2001 FoxPro Advisor article, "Running Loosely Connected, Part 3" to synchronize updates in tables between headquarters and remote locations.

A "ModNumber" field in maintained in each table. Every time any change is made to the table, the modNumber is incremented. Then when it's time to sychronize, it can be determined which records have to be updated.

My problem is in the maintenance of the modNumber field.

In each table, i have the record validation rule as:
newModNumber(cThisTablename,cThisModNumberField)

newModNumber is a stored procedure, as follows:
FUNCTION NewModNumber

LPARAMETERS tcTable, tcField

LOCAL liModNumber

liModNumber = AssignModNumber( tcTable, tcField )
REPLACE ( tcField ) WITH liModNumber IN ( tcTable )

RETURN .T.
** End NewModNumber
I am getting the error "Illegal recursion in rule evaluation" when the REPLACE statement is executed.

The AssignModNumber Function is:
***********************************
** from Craig Berntson's Knowledgebase - 8/24/99
** used to generate ModNumbers
FUNCTION AssignModNumber

LPARAMETERS tcTable, tcField

LOCAL lnArea, liModNumber

* Save current work area
lnArea = SELECT()

IF !USED("GeneratePK")
  USE sagenpk IN 0 SHARED ALIAS GeneratePK
ENDIF
SELECT GeneratePK
SET ORDER TO TAG GPK_PK

* FLOCK seems to work a bit better than RLOCK.
* I've never had a problem with it
DO WHILE !FLOCK()
ENDDO

SEEK UPPER(tcTable)
IF FOUND()
  REPLACE gpk_CurrentModNumber WITH gpk_CurrentModNumber + 1
  liModNumber = gpk_CurrentModNumber
ELSE
  INSERT INTO GeneratePK ( GPK_PK, gpk_CurrentNumber, gpk_CurrentModNumber ) ;
    VALUES ( UPPER( tcTable ), 0, 1 )
  liModNumber = 1
ENDIF

FLUSH
UNLOCK

SELECT (lnArea)
RETURN liModNumber
** End AssignModNumber
I am using views. The VIEW doesn't have a row rule, but I THINK what might be happening is that the rule is somehow being called twice (yes, recursion....) perhaps once for the table and once for the rule? When i update the table directly, in a browse, the modNumber is incremented properly.

Once i get the "Illegal recursion in rule evaluation" my only options are CANCEL and HELP. I choose CANCEL, and a PROCEDURE CANCELLED message appears. I click on OK and i'm back in the NewModNumber procedure again...on the line before the REPLACE.

Any insight or help is appreciated! TIA, j
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform