Solved

VFP 8 vs. VFP 9 ENGINEBEHAVIOR

Posted on 2013-11-27
2
619 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 41

Accepted Solution

by:
pcelba earned 500 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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now