Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP new bug: UPDATE with SET RELATION fails
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00588420
Message ID:
00588556
Views:
31
>Sergey, I'm not clear on exactly what you mean here. If I run an UPDATE-SQL against a table that is not open (or a DELETE-SQL as well), VFP will open it and perform the action that I am requesting. So it is possible that VFP is also performing the USE AGAIN... logic that it employs in SELECT-SQL. One reason it might work this way (or at least conditionally work this way) is that these actions could be wrapped in a BEGIN TRANSACTION...END TRANSACTION construct. In such a case, these actions might have to be rolled back. Actions could then be performed on a working copy of the table until a decision is made to commit the actions.
>

Yes, UPDATE-SQL would open a table if it wasn't open before. However, if the table is open already than UPDATE-SQL would use it not a copy opened with USE ... AGAIN. Run following code and step thru it in the debugger. Watch as record pointer moves in the testit table.
CREATE table testit ( Field1 I )
INSERT INTO testit VALUES (10)
INSERT INTO testit VALUES (20)
INSERT INTO testit VALUES (30)

BROWSE LAST NOWAIT
ACTIVATE WINDOW TRACE

SUSPEND

UPDATE testit ;
    SET Field1 = myfunc1() 
RETURN

FUNCTION myfunc1()
RETURN 1
IMO, SQL UPDATE should work the same way as SQL SELECT, but it doesn't.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform