Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: only null values in SELECT member can to used
Message
 
 
To
01/05/2004 16:56:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00900095
Message ID:
00900096
Views:
24
Fabio,

You should be aware that comparing anything to Null doesn't make any sense because result is always Null. The query that generates an error is equvivalent to the following one
	SELECT myParent.* FROM myParent ;
	         WHERE myParent.rId = Null ;
	         INTO ARRAY ZZ 	
The correct way is to use IS NULL operator if you want to check for Nulls.
	SELECT myParent.* FROM myParent ;
	         WHERE myParent.rId IS NULL ;
	         INTO ARRAY ZZ 	
>If you declare a field not nullable, and index it ( like a id AUTOINC primary key ),
>and use it into a SELECT SQL,
>VFP can optimize it and use the index for search other SELECT fields with null values,
>BUT, if you search the same field value when it is outside of the query,
>VFP fire a index error.
>
>Repro:
>
>WITH CREATEOBJECT('session')
>	SET DATASESSION TO .DatasessionId
>	CLEAR
>	CREATE CURSOR myParent ( rId I UNIQUE)
>	FOR k=1 TO 10
>	  INSERT INTO myParent VALUES (M.K)
>	NEXT
>	ON ERROR ? 'ERROR >>>>>>>>>>   ',MESSAGE()
>
>	CREATE CURSOR myCursor( fkId i NULL)
>	INSERT INTO	myCursor VALUES (NULL)
>	SYS(3054,12)
>
>	SELECT myParent.* FROM myParent,myCursor 
WHERE myParent.rId=myCursor.fkId 
INTO ARRAY ZZ 	&& this not fire THE INDEX error
>	
>	SELECT myParent.* FROM myParent          
WHERE myParent.rId=myCursor.fkId 
INTO ARRAY ZZ 	&& this     fire THE INDEX error
>		
>	
>
>	ON ERROR
>ENDWITH
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform