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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only