Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set
Message
From
26/06/2002 08:30:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00671823
Message ID:
00672407
Views:
7
>>A view is just like a cursor in this sense. Data selection should be as fast as the corresponding cursor.
>>
>>Usually you would use a parameterized query for selecting a small subset of a large table. For instance, "Client = ?vClient". Note the question mark - it is customary - and legal - to include a question mark here. This indicates to VFP that, if the variable doesn't exist, the user will be shown a dialog (but you want to avoid this at all costs). Some frameworks parse for the question mark, so I recommend to include it. As a matter of fact, I never tried to define a parameterized view without it.
>>
>>The view will simply simplify some programming aspects. Specifically, VFP takes over more of your work. You issue TableUpdate(), and VFP takes care of finding the records to update (or creating new records) in the original table.
>>
>>HTH, Hilmar.
>
>What about record locking? In the approach I'm actually using don't have to worry too much about it since I only begin the transaction before start updating the table, so the records are locked for a really short time.

I recommend optimistic buffering:
CursorSetProp("Buffering", 3) && optimistic row buffering

or:

CursorSetProp("Buffering", 5) && optimistic table buffering
You no longer need explicit table locking. TableUpdate() will implicictly lock the record, for the short time the record is saved. It will also detect whether another user made changes in the meantime. TableUpdate() will fail in this case (with the default options - see the help file). The user will have to undo in this case.

Since this is a rare case, and it is an advantage to have records locked only for a very short time (and only if the user really decides to save!), optimistic buffering is usually recommended.

>Please don't think my questions are stupid or something, I know I can read about views on the VFP help and many of my doubts will be answered but I always prefer having real world answers.

Feel free to ask. In general, no question is considered stupid on this forum - whether it be a beginners question, or an advanced one.

And the VFP is not always quite clear on some details.

Saludos, Hilmar.

Oh, BTW, we can switch to Spanish whenever you like - although I see that you don't have problems with English.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform