Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
New to VFP buffering.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00053915
Message ID:
00054042
Views:
38
>Hi,
>
>I'm fairly new to VFP and had a question regarding buffering, so I thought I would ask the experts out there. I have a table in a form's DE and have it set to use the forms default buffering. The form is set to 2 - Optimistic buffering. I have a push button on the form that populates the table with data from an array. What method do I use:
>
>Do I use my old FP2.6 code:
>
>SELECT table
>FOR nCtr = 1 TO ALEN(Array,1)
> IF SEEK(array(nCtr)
> IF RLOCK()
> REPLACE field1 WITH array(nCtr,1)
> REPLACE field2 WITH array(nCtr,2)
> UNLOCK
> ENDIF
> ELSE
> APPEND BLANK
> REPLACE field1 WITH array(nCtr,1)
> REPLACE field2 WITH array(nCtr,2)
> UNLOCK
> ENDIF
>ENDFOR
>
>or.......
>
>Can I use the following:
>
>SELECT table
>FOR nCtr = 1 TO ALEN(Array,1)
> IF SEEK(array(nCtr)
> REPLACE field1 WITH array(nCtr,1)
> REPLACE field2 WITH array(nCtr,2)
> ELSE
> APPEND BLANK
> REPLACE field1 WITH array(nCtr,1)
> REPLACE field2 WITH array(nCtr,2)
> ENDIF
>ENDFOR
>TABLEUPDATE(.T.)
>
>Also, would using a INSERT-SQL statement be preferable over APPEND BLANK in the above example? Would I still issue a TABLEUPDATE(.T.) at the end if I did?
>
>One more thing, I have seen the following used: TABLEUPDATE(.T.,.T.) In help, I could only find one logical parameter to pass. What are these parameters used for?
>
>TIA for any expert advise!
>
>James Moore

Some thoughts:

I never use the explicit locking commands, FoxPro handles that automatically for all my purposes.

Use INSERT-SQL - it's faster, because it updates the indexes once, while APPEND BLANK does it twice.

The second TABLEUPDATE parameter is lForce, which will forcably overwrite changes made by another network user.

Optimistic buffering is faster, fine for most situations; use row buffering for parent tables, table buffering for children.

HTH
Darren Young
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform