Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG :VFP's Transactions are only corrected with bufferin
Message
De
14/12/2004 16:01:47
 
 
À
14/12/2004 09:32:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00968242
Message ID:
00969264
Vues:
11
Hi Fabio,

I was replying in context of the scenario that you have provided. In that scenario, due to BEGIN/END TRANSACTION, VFP caches the record content separately from the file cache. Therefore, for not modified record, WORKAREA.F1 and OLDVAL("F1",WORKAREA) are the same.

In general, VFP does a lot of caching to achieve better performance (content of the file is cached, content of the current record might be cached, old values are cached). It is not a secret that cache can get out of date and data can get out of sync. If the app needs up to date information, it should make sure it has it by locking and/or refreshing data.

Thanks,
Aleksey.

>>Hi Fabio,
>>
><snip>
>>
>>I admit, at first the behavior looks very strange, but there is an explanation for it.
>>
>>The CURVAL() and OLDVAL() functions are designed for the specific scenario - update conflict management and resolution.
>>
>>1) Here is how documentation describes the OLDVAL function: "Returns original field values for fields that have been modified but not updated." If record is not modified then it is expected to get the same value for WORKAREA.F1 and OLDVAL("F1",WORKAREA).
>
>>
>>2) Documentation for CURVAL() says the following: "CURVAL( ) and OLDVAL( ) can only return different values when optimistic row or table buffering is enabled." Therefore, for Buffering=2 or 4, it is expected to get the same value for OLDVAL("F1",WORKAREA) and CURVAL("F1",WORKAREA).
>
>Run this code:
>observed: point 1 it is not true!
>
>
>* changing Buffering combination, you change the record buffer values
>#DEFINE _BUFFERINGMODE2	5
>
>CLEAR
>
>* NEXT line it is useless
>SET REFRESH TO 0,0 && The buffers are never refreshed if nSeconds2 is set to 0.
>
>S1=CREATEOBJECT("SESSION")
>	SET DATASESSION TO S1.DATASESSIONID
>	SET MULTILOCKS ON
>	CREATE CURSOR myCursor ( F1 I) && exclusive mode
>	APPEND BLANK
>	USE DBF() IN 2 AGAIN ALIAS myCursor_2
>	CURSORSETPROP("Buffering",_BUFFERINGMODE2,2)
>
>	Update2(2)
>	Update2(3)
>	Update2(4)
>	Update2(5)
>		
>RELEASE S1
>
>PROCEDURE Update2(buffmode)
>	CURSORSETPROP("Buffering",m.buffmode)
>	?
>	? "buffering : ",CURSORGETPROP("Buffering")
>	FOR K=1 TO 2
>
>		?
>		? CHR(9),ALIAS('myCursor_2'),"before Update",myCursor_2.F1
>		REPLACE F1 WITH F1+2 IN myCursor_2
>		TABLEUPDATE(.f.,.f.,'myCursor_2')
>		?? "    After ",myCursor_2.F1
>		?
>		? "FIELD ON ",ALIAS()," IS ",F1,OLDVAL("F1"),CURVAL("F1")
>		? "REFRESH RECORD"
>		GO RECNO() && THIS REFRESH THE RECORD BUFFER !!!!!!!
>		? "FIELD ON ",ALIAS()," IS ",F1,OLDVAL("F1"),CURVAL("F1")
>	NEXT
>
>
>Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform