Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What was the bug in VFP 6?
Message
 
 
To
16/05/2019 06:32:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01668637
Message ID:
01668659
Views:
46
Hi Cetin,
Thank you for the input and for your code demonstrating the case.
My case does not involve an array at all. So, it must be that my SUM works. And therefore, the bug or whatever happened to the customer is something else.

>Actually if you accept SUM ... to is working correct, then there weren't a bug in VFP6. It would be different, just in case you are selecting result to an array. Otherwise in VFP6 Select Sum() and SUM ... To ... would return you the same result (which was seen as a bug by some):
>
>
>create cursor test (foreignKey I, someValue I)
>insert into test  (foreignKey I, someValue I) values (1, 10)
>insert into test  (foreignKey I, someValue I) values (1, 10)
>insert into test  (foreignKey I, someValue I) values (1, 10)
>insert into test  (foreignKey I, someValue I) values (2, 10)
>
>SUM someValue to nResult for foreignKey = 1 && m.nResult is 30
>SUM someValue to nResult for foreignKey = 5 && m.nResult is 0
>
>Select SUM(someValue) as totVal from test where foreignKey = 1 into cursor crsResult
>? totVal && 30
>Select SUM(someValue) as totVal from test where foreignKey = 4 into cursor crsResult
>? totVal && 0
>
>* But if that were done into an array
>
>Select SUM(someValue) as totVal from test where foreignKey = 1 into array laResult
>? laResult && 30
>Select SUM(someValue) as totVal from test where foreignKey = 5 into array laResult
>? laResult && 30
>
>
>Select SUM(someValue) as totVal from test where foreignKey = 1 into array laResultFirst
>? laResultFirst && 30
>Select SUM(someValue) as totVal from test where foreignKey = 5 into array laResultSecond
>? laResultSecond && variable not found error
>
>
>SQL SUM() was corrected (it could be debated the otherwise but it followed what ANSI SQL does) to return NULL when there is no matching criteria. IOW in VFP9 second SQL would return a row with a NULL value for sum.
>
>>Hi,
>>
>>I have a line of code in my program which has a comment dating back to 2002 and refers to a bug in VFP 6.
>>
>>Here is the line with the comment:
>>
>>*** 11-18-2002 REFACTORING. Calculate QTY In Stock (in INVSTOCK) and update field INVNTORY.INSTOCK 
>>***                        Note: Using SUM() function instead of SQL Select because of bug in VFP 6.0 
>>SELECT (cInvenStockView)
>>SUM QTY_LEFT to nQtyInStock for REC_ID = "1" AND INVEN_PK = tnInvenPk
>>
>>
>>The code above should calculate the sum of field QTY_LEFT. Which could be done by SQL Select from the Cursor Adapter cursor.
>>
>>I know I should know why I used SUM instead of SQL Select. But can someone remember what was the bug? And should I now (since the program is in VFP 9) change the above code from SUM to SQL Select?
>>
>>TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform