Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any way to speed up TableUpdate?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00388410
Message ID:
00389183
Views:
30
Nadya:

I'm talking about sanning the change buffer and hardcoding the update, insert and delete statements (this is what tableupdate does when optimistic table buffering is on). You can build up the SQL strings generically in a program then macro expand them, but if your looking for performance, the macro could slow you down.

set deleted off
IF GETNEXTMODIFIED(0, sometable) != 0 && are there changes?
scan && scanning the buffer
lcFldStatus = GETFLDSTATE(-1, sometable) && is this recorded modified?
IF '2' $ lcFldStatus .OR. '4' $ lcFldStatus
do case
case deleted() && delete
delete from ... where sometable.primarykey = curval(sometable.primarykey)
case recno() < 0 && new record, insert
insert into ...
*- now assign a primary key
otherwise && update
update sometable ... where sometable.primarykey = curval(sometable.primarykey)
endif
endscan
endif

I use code similar to this in my client server framework, but not when using fox data. I rely on tableupdate() for convience.

Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform