Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Buffering vs Begin..End Transaction
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00305569
Message ID:
00353677
Views:
29
Jim,

I noticed, that sometimes TableUpdate takes a lot of time (~20-30 sec. or even more). There could be a Filter on a table (I know, that's almost prohibited now to use filters, but it could not be done another way, unfortunately). I also think, that we should use Transactions, but don't know, how to put them into this code. There is a code in the Close method of our Form class:
*--------------------------------------------------------------------------
* -- Close form
*--------------------------------------------------------------------------
*--------------------------------------------------------------------------
* -- NSL 3/3/00 Implementation of requested class changes
* -- Always have the close button enabled, and do a tableupdate()if changes have been made.
* -- Note:  We could have called the edit/add to do the revert/update, but we were in the for loop anyway
*--------------------------------------------------------------------------
IF thisform.lprocessform
   lnoldrec = RECNO((THISFORM.DATAENVIRONMENT.INITIALSELECTEDALIAS))
	Local lnModified,lresp
	lresp=0
   FOR i=1 TO THISFORM.numopen
      SELECT (THISFORM.laDE[i,1])
      IF CURSORGETPROP("Buffering") >3  && NSL 3/3/00 Must be table buffering to save
         * -- If a table has been modified, then need to ask the user whether to save or revert
         lnModified=GetNextModified(0)  
         IF lnModified<>0 and lresp=0
         	lresp=messagebox('Do you want to save changes?',36)  &&+32
         ENDIF
        IF lresp=7  && User requested that changes not be saved.
     		=TABLEREVERT(.T.,THISFORM.laDE[i,1])
     	ELSE  		
     		=TABLEUPDATE(.T.,.T.)
     	ENDIF
      ENDIF
   ENDFOR

   SELECT (THISFORM.DATAENVIRONMENT.INITIALSELECTEDALIAS)

   IF BETWEEN(lnoldrec,1,RECCOUNT())
      GOTO lnoldrec
   ENDIF
ENDIF
* -- 3/3/00 End of changes
THISFORM.RELEASE()
Thanks in advance.


>>What is the impact ( if there is one) in time responses on a transaction? Would any be delayed?
>
>Pablo,
>
>What time restrictions? Simply stated a transaction should last no longer than is absolutely required. This means do all the work first and when the only thing left to do is to TableUpdate start the transaction, do the updates and end the transaction.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform