Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using == vs =
Message
From
08/11/2015 13:59:12
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
08/11/2015 13:55:46
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01627149
Message ID:
01627225
Views:
84
>>I am absolutely convinced that you are wrong. I am curious to see if you can prove your statement.

I think we're both right- sort of! VFP Help confirms that if two strings are compared with the == operator, the expressions must contain exactly the same characters, including blanks, to be considered equal and that SET EQUAL is ignored.
CREATE CURSOR c1 (myfield1 c(10),myfield2 c(11))

? c1.myfield1==c1.myfield2
? c1.myfield2==c1.myfield1

INSERT INTO c1 VALUES ("Hello","Hello")

? c1.myfield1==c1.myfield2
? c1.myfield2==c1.myfield1
.F.
.F.
.F.
.F.

This is what I focused on as Walter said this wasn't about VFP data. However if using SQL, including in a resultset from a backend: == acts the same as = with SET ANSI ON- IOW the shorter string is padded.
CREATE CURSOR c1 (myfield1 c(10), myfield2 c(11))
INSERT INTO c1 VALUES ("Hello","Hello")
SELECT * FROM c1 WHERE myfield1==myfield2
? _TALLY
1
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform