Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VFP 8 vs. VFP 9 ENGINEBEHAVIOR

Posted on 2013-11-27
2
Medium Priority
?
657 Views
Last Modified: 2013-11-27
I am having a problem where a query produces different results based on whether it's run in VFP 8 or VFP 9. Here is the query :

SELECT DISTINCT gage.gageno, gage.loc, gage.lastused, gage.duedate, gage.outofserv, gage.gagedesc, gage.customer, gagepart.partno
FROM gage LEFT JOIN gagepart ON ALLTRIM(gage.gageno) = ALLTRIM(gagepart.gageno)
WHERE LEFT(gage.gageno,6) == '13-01-' INTO CURSOR fred

The following are settings in both versions :

ANSI = OFF
EXACT = OFF
ENGINEBEHAVIOR = 70

When run in 9, the query includes a record where the GAGEPART table contains a record with a blank gageno field. When run in 8, it does not. I know I could rectify this by replacing the = in the JOIN clause with a ==, but I'm looking for the reason why this happens. Is there some other setting I need to look at ?

Any insight here would be appreciated.
0
Comment
Question by:AlanArons
2 Comments
 
LVL 43

Accepted Solution

by:
pcelba earned 2000 total points
ID: 39681594
SET EXACT is not important here. Other settings which could affect the result are: SET COLLATE, CPCURRENT(), CPDBF(), and maybe SET DELETED.

The row having empty gagepart.gageno should be on output in all cases because SET ANSI OFF forces the string comparison to the length of the shorter of both strings - so if one of the strings contains just spaces the ALLTRIM converts it to zero length string and the JOIN condition must be True because you are comparing two zero length strings.

I cannot test this behavior in VFP 8 just now but I am sure VFP 9 has many previous bugs  fixed... so let say this was bug in SQL engine prior to VFP 9 (if this is not caused by Collation or Code Page settings).

SET ANSI ON removes blank gagepart.gageno records from output.
0
 

Author Closing Comment

by:AlanArons
ID: 39681689
I was afraid that might be the case.   It occurred to me that the result in 8 given the settings should be incorrect.   I was trying to avoid having to go through all of our code and try and find where this might apply.   Looks like we should turn ANSI on in the programs while still running in 8 (I can do it in the base class for the form.)  and see if it affects anything.  Then when we go to 9 it shouldn't have an effect.  

Thanks for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
The decision to migrate to the cloud is not a simple one—many factors, such a cost, ease of use, and ongoing maintenance come into play. The goal is always for cloud platforms to make storage and backups more seamless and effective. Here’s a look at…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question