Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Stefan Wuebbe
 To: jon bing
 jon bing
Subject: RE: Buffering mode
Thread ID: 310612 Message ID: 310666 # Views: 55 # Ratings: 0
Version: Visual FoxPro 7 Category: Databases, Tables and SQL Server
Date: Thursday, June 23, 2011 9:30:40 AM         

Hi Jon,

> Hi guys,
> I just have a couple of quick question regarding the Buffering mode :
> currently I use =
> 1. For the Master form = I use buffering mode 5.
> For the Transaction form = I use buffering mode 3 for the header table
> and buffering mode 5 for the detail table.
> is this allright..? It's because I read in some vfp books thats says we should
> always use buffering mode 5

They say so because with buffer mode 3, "optimistic row" buffering, any unintentional record pointer movement would cause an unintentional, implicit table-update attempt.
Since that one might either work or not, your code cannot "see" the result since there is no explicit TableUpdate() in that case, no chance to use AError() to determine the reason, give user feedback.

IOW, buffer mode 5 is more reliable.
Whereas buffer mode 3 is a good thing when you are triple-sure that no unintentional record pointer can never ever happen.

> 2. In my older application,
> In my transaction form. I use only TABLEUPDATE AND TABLEREVERT --WITHOUT -- BEGAN AND END TRANSACTION.. and buffering mode 5 for both header and detail table.
> it works fine for a couple years ( single user )
> however when it is being used by multi user.. It seems have to loose some data in monthly basis. Like twice a month
> Can someone explain this..? it's because the BUFFERING MODE or because of the MISSING BEGAN AND END TRANSACTION...?
> thank you so much..

If you have a typical header-and-detail table scenario, doing update attempts inside a "Begin Transaction" block makes sense because when any of the two separate TableUpdate() attempts fails, you may want to Rollback the entire thing.
IOW, it does not make sense not to use a Transaction in that case :-)

As for the lost-data-twice-per-month: theoretically it might be explained by the missin Transaction, but practically nobody might be able to tell w/o seeing your code.

As for the single-vs-multi-user observation: in a single-user scenario a few typical update conflicts cannot happen - but others can, like violated field rules etc.
So that difference you observed might just mean that you have been lucky in the single-user case and might want to use a Transaction in the scenario you described even in that case and anyway.



Buffering mode Posted by jon bing @ 6/23/2011 1:47:44 AM
RE: Buffering mode Posted by Stefan Wuebbe @ 6/23/2011 9:30:40 AM
RE: Buffering mode Posted by jon bing @ 6/24/2011 1:51:59 AM
RE: Buffering mode Posted by Anders Altberg @ 6/23/2011 12:20:10 PM
RE: Buffering mode Posted by jon bing @ 6/24/2011 1:54:39 AM
RE: Buffering mode Posted by Anders Altberg @ 6/24/2011 12:54:17 PM