Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local Views at Wits End
Message
De
05/06/2003 18:04:42
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Local Views at Wits End
Divers
Thread ID:
00796970
Message ID:
00796970
Vues:
77
I'm having a hell of a time trying to get a local view to update properly in a multi-user environment, in VFP6 or 8. Maybe I'm missing something, but here's the scenario: Two users trying to get the next available part number at the same time using a local view (VSYS) on an unbuffered table called SYSINFO.DBF using the following code.
local myID

SELECT VSys
do while .T.

	myID = VSys.NextID
	VSys.NextID = VSys.NextID + 1

	if TableUpdate( .T., .F., "VSys" )
		EXIT
	else
	  	TableRevert( .T., "VSys" )
		Requery("VSys")
	endif

enddo
...
return ( myID )
I'm opening the view at runtime and letting the view open it's source table - For some reason, when I requery the view it knows that it's source table was changed and updates itself accordingly, but the cursor it opened originally does not reflect the change (unless you browse the file - then it snags the new value just fine).

Using the debugger I watch the SYSINFO.NEXTID and VSYS.NEXTID fields. The value of both is 1 on the way in - I try to change it to 2 in VSYS and tableupdate. It fails becuase someone else changed it before me, so I revert and requery. Next time up, the VSYS.NEXTID shows 2 (properly) and SYSINFO.NEXTID shows 1 (the original value). GETFLDSTATE("NEXTID") in VSYS reports no modifications, so I go ahead and advance it to 3. The next time I hit TableUpdate() it fails and I revert/requery again - the VSYS.NextID value is 2, Sysinfo.NextID value 1 and the GetFldState reports unchanged...
the exact same results!

What gives? The view is refreshed and it knows nothing has changed! I can stop it by closing the underlying SYSINFO.DBF table after the requery, but I was under the impression that the view handles that stuff for me? Why is it going all the way back to it's original table to determine if it's something has changed? Any ideas?

Many Thanks for any clarity you can provide...
~Erik Folley
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform