Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Always stops evaluating if..?
Message
De
16/08/2005 04:00:23
 
 
À
15/08/2005 19:50:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
01041159
Message ID:
01041229
Vues:
15
>>>As far as I know, vfp always stops evaluating the right remainder of a logical expression if the left part evaluates to an logical value that cannot be changed anymore by the right remainder. For example, in the case of IF A OR B, the B is no longer evaluated if A evaluates to True. In a same vein, in the case of IF A=0 or BB(), the function BB is not visited if A=0.
>>>
>>>But now I am confronted with a case in a select-sql WHERE expression, where the part to the right of the OR is visited anyhow, notwithstanding the result of the left expression.
WHERE ( MOD(A,1000)#0 OR THERMO(A) )
>>>
>>>Does this sound familiar to anyone here?
>>
>>You ignores the phase of analysis,
>>and
>>Check A, it should to be NULL.
>
>It is never NULL.

Post more info.
Look this:
clear
SET NULLDISPLAY TO "I'm null"
CREATE CURSOR myTest (A I NULL)
INSERT INTO myTest VALUES (5)
INSERT INTO myTest VALUES (0)
INSERT INTO myTest VALUES (0)
INSERT INTO myTest VALUES (null)
INSERT INTO myTest VALUES (2)	&& VFP don't visit THERMO here
INSERT INTO myTest VALUES (1)	&& VFP don't visit THERMO here
INSERT INTO myTest VALUES (7)	&& VFP don't visit THERMO here
INSERT INTO myTest VALUES (0)

SELECT 0

SELECT * FROM myTest;
	WHERE (MOD(A,1000)#0 OR THERMO(A));
	INTO CURSOR rrr

PROCEDURE THERMO(vValue)
	? "recno()=",RECNO(),"A=",vValue
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform