Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RECALL with updateable views - bug?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
RECALL with updateable views - bug?
Miscellaneous
Thread ID:
00807071
Message ID:
00807071
Views:
71
I was getting duplicate keys in an app using an updateable local view to update a free table. Yesterday I discovered that recalling a deleted record in a view DOES NOT RECALL the record in the base table, but actually creates a new record, a duplicate!!!

Unless I missed something, this makes updateable views not only useless, but extremely dangerous.

Here is code to reproduce the behavior:
local lcDir, lnCnt

close data all

*lcDir='c:\fox\test1\test3'
lcDir = 'c:\lvtest\'

md (lcDir)

set default to (lcDir)

create table (lcDir)+'table1' free (id1 N(10), text1 C(10))
for lnCnt = 1 to 5
	insert into table1 (id1, text1) values (lnCnt, chr(lnCnt+64))
endfor 

create database 'db1.dbc'
create sql view "lv_table1" as select id1, text1 from  table1

dbsetprop('lv_table1', 'View', 'UpdateType', 1)
dbsetprop('lv_table1', 'View', 'WhereType', 3)
dbsetprop('lv_table1', 'View', 'SendUpdates', .t.)
DBSetProp('LV_TABLE1', 'View', 'Tables', 'table1')

dbsetprop('lv_table1.id1', 'Field', 'KeyField', .t.)
dbsetprop('lv_table1.id1', 'Field', 'Updatable', .t.)
dbsetprop('lv_table1.id1', 'Field', 'UpdateName', 'table1.id1')

dbsetprop('lv_table1.text1', 'Field', 'KeyField', .f.)
dbsetprop('lv_table1.text1', 'Field', 'Updatable', .t.)
dbsetprop('lv_table1.text1', 'Field', 'UpdateName', 'table1.text1')

close data all

select 0
use table1
browse last nowait

select 0
use db1!lv_table1
browse last nowait

delete
?tableupdate(1,.t.,'lv_table1')
recall
?tableupdate(1,.t.,'lv_table1')
Now if you click on the table1 browse window, you should see a duplicate record.

I really hope I am missing something...
Doru
Next
Reply
Map
View

Click here to load this message in the networking platform