Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids, transaction and buffering doubt.
Message
From
11/09/2003 08:47:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/09/2003 07:36:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00828094
Message ID:
00828112
Views:
13
>Hello group,
>
>So, let´s say I have an invoice with it´s details in a Grid: Products, etc.
>And in the header of the invoice: Customer name, Date, etc.
>This is a very typical situation.
>
>Now, I need to probe that I can give the user the option to REVERT ALL changes and protect in case of PC failure. To revert ALL if the user wants, and Transactions if the power suply is interrupted and the PC rebboted to keep data integrity.
>
>With record locking I do a simple tablerevert() for the Main table.
>But, for the child table -the lines in the grid- I believe that I should use TABLE Buffering instead of record buffering
>In both cases I can get everything back with a tablerevert() call.
>I need to protect everything within Transactions.
>
>So, I am trying to figure out which is the best implementation.
>Is it true that in this case the Begin Transaction..End transaction will "eat" tons of memory because of table buffering and the use of getfldstate() for each record?
>
>Record Buffering for the main table, and Table Buffering for the grid-child-table.
>
>
>As you can imagine, the record-pointer moves in the child table, makes changes, saves, etc...
>But I want it all in a (single?) transaction, then the user can revert all changes already saved in the grid, adn the current changes.
>
>I know that something I mentioned above is wrong in it´s conception, so I need a little push to explain this to the team. I want to push the limits of Visual FoxPro and All buffering methods whould be supported by my Framework.
>
>Any thought will be appreciated,
>Pablo S.Velazco

Pablo,
You could use row-table buffering for parent-child or table-table buffering for both (with table buffering you still have the control to do tableupdate(),tablerevert() on single or all records). My preference is to use 'table' buffering always.

If all changes would be recorded realtime then it'd be unefficient to use buffering at all. Just wrap in a transaction.
To me it sounds you'd want to save when the invoice is complete. With optimistic buffering then you'd roughly do something like :
begin transaction
if tableupdate(0,.f.,'parent') and tableupdate(2,.f.,'child)
 end transaction
else
 rollback
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform