Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP new bug: UPDATE with SET RELATION fails
Message
From
03/12/2001 12:37:33
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00588420
Message ID:
00588786
Views:
21
>>>The bug appears is that vfp sql optimizer takes eof() function as constant
>>>expression and thus refuces to run UPDATE command.
>>
>>>If EOF() is initially .T., update command runs and updates correct records.
>>
>>I don't think this is a bug. A WHERE clause creates a filter condition (which is like a constant expression) that will become a yardstick that will be used to determine what records should be included in the result set or acted upon. In this case RCursor was at EOF, and seeing that VFP didn't have to go any further to determine that 0 records would meet the filter condition.
>
>In this case please explain while following SQL UPDATE updates one record under the same conditions.
 UPDATE Cursor1 ;
>    SET Field1=Field1 ;
>    WHERE !EOF('RCursor')
>
if there is no optimizable parts in WHERE clause,
vfp scans all records and evaluates WHERE condition for each clause.

If there is optimizable construction in WHERE clause, VFP SQL optimizer starts working. There seems to be bug in a SQL optimizer.
It thinks that EOF() function is constant and evaluates it using only the CURRENT updatable record.

If it is initially .F., VFP finds that there is no reacon to scan any record.
If it is initially .T. , VFP scans records and evaluates EOF() again for each record.

For example, if you simply change the order of the two insert statements in my sample program, correct result is returned.
Andrus
Previous
Reply
Map
View

Click here to load this message in the networking platform