Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array Nonsense
Message
From
25/07/2008 16:03:41
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01334124
Message ID:
01334149
Views:
13
Thanks, Sergey.

This one had us all stumped for awhile.

>It's behavior change to make VFP 9.0 SQL more ANSI SQL Standard compliant. It's documented in in SET ENGINEBEHAVIOR help topic: "When using aggregate functions, such as MAX( ), in the SQL SELECT command without a GROUP BY clause, and no matching records are found, Visual FoxPro returns a result set with a single record and _TALLY set to 1. In versions prior to Visual FoxPro 9.0, no records are returned, and _TALLY is set to 0".
>
>Creating of an array in the first your example is a side effect of the above change.
>
>>Upon further investigation, I have discovered that the problem with SQL Select and arrays only occurs when using a function is the Select statement.
>>
>>Run the following code in VFP 9.0:
>>
>>SET ENGINEBEHAVIOR 90
>>
>>CREATE CURSOR test (KY i)
>>SELECT MAX(KY) FROM test INTO ARRAY laTest
>>
>>debug
>>SUSPEND
>>
>>Examine the contents of laTest in the Locals window. The result will be null. Now run this code:
>>
>>SET ENGINEBEHAVIOR 80
>>
>>CREATE CURSOR test (KY i)
>>SELECT MAX(ky) FROM test INTO ARRAY laTest
>>
>>debug
>>SUSPEND
>>
>>The array is not created.
>>
>>Now run the following:
>>
>>SET ENGINEBEHAVIOR 90
>>
>>CREATE CURSOR test (ky i)
>>SELECT ky FROM test INTO ARRAY laTest
>>
>>debug
>>SUSPEND
>>
>>The array is not created.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform