Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: only null values in SELECT member can to used
Message
From
01/05/2004 16:56:35
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
BUG: only null values in SELECT member can to used
Miscellaneous
Thread ID:
00900095
Message ID:
00900095
Views:
64
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
		
	
*!*		SELECT myParent.* FROM myCursor X JOIN myParent ON myParent.rId=X.fkId AND myParent.rId=NULL	INTO ARRAY ZZ 	&& this     fire THE INDEX error
*!*		SELECT myParent.* FROM myCursor X JOIN myParent ON myParent.rId=X.fkId AND myParent.rId IS NULL INTO ARRAY ZZ 	&& this not fire THE INDEX error
*!*		SELECT myParent.* FROM myCursor X JOIN myParent ON myParent.rId=X.fkId OR  myParent.rId=NULL	INTO ARRAY ZZ	&& this not fire THE INDEX error

	ON ERROR
ENDWITH
Next
Reply
Map
View

Click here to load this message in the networking platform