On Thread #
971482 a changed behaviour it is posted.
Now i remember it.
It is a VFP8 bug fixed.
Cause:
with SET ANSI OFF,
any string function that can set the string expression to ''
it is a candidate to show a VFP bug.
The because of a bug in the code that uses the indices.
VFP must bring back the same ones turns out to you with:
... WHERE CExp1 = CExp2
... WHERE CExp2 = CExp1
is that it uses an index, is that it does not use it.
VFP standard code, have a limit, and it optimize the left expression only,
then if a zero lenght string key exists on the index,
the two queries return a different set.
Sin that, instead correcting the error in the search code,
the team fix the error disabling the optimization when
in the expression is present a function that can generate one zero lenght espression ''.
Then:
into VFP8
STRTRAN()
CHRTRAN()
REPLICATE()
STUFF()
STUFFC()
TRANSFORM()
they are not optimizable
into VFP9, the Team have has added these to the not optimizable functons list
for SET ANSI OFF:
ALLTRIM()
LTRIM()
TRIM()
RTRIM()
LEFT()
LEFTC()
RIGHT()
RIGHTC()
STRCONV()
they are not optimizable.
But the VFPT job it is not completed !
The same bug it is live on this code ( i test this into VFP9 Beta):CREATE CURSOR CONTDB (LN C(10),lencode I )
INSERT INTO CONTDB VALUES ('',1)
INSERT INTO CONTDB VALUES ('',0)
INSERT INTO CONTDB VALUES ('VOSS',3)
INSERT INTO CONTDB VALUES ('VOSS1',2)
INDEX ON SUBSTR(ln,1,lencode) TAG TT
CLEAR
SET ANSI OFF
=SYS(3054,11)
SELECT * FROM CONTDB WHERE 'V' = SUBSTR(ln,1,lencode)
SELECT * FROM CONTDB WHERE SUBSTR(ln,1,lencode) = 'V'
Of course the same bug appear with:SUBSTRC()
PADR()
PADL()
PADC()
GETWORDNUM()
SPACE()
For fix the bug, VFPT have cut the optimization;
but this is a simple shortcut mode only for workaround the seek bug;
if VFPT rewrite the C seek inner code,
VFP can optimize these expression
on the SET EXACT OFF context.
Fabio