Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why I cannot search a NULL value ? BUG ?
Message
 
 
To
30/08/2003 13:02:58
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00824792
Message ID:
00824807
Views:
26
Hi Fabio,

>>I think that it's a bug but to demonstrate that you've to make sure that variablr 'x' has proper type because in you code its type is 'L'.
>
>I was sure of this note, try with:
>
>...
>x=VAL(NULL)
>...
>

I agreed with you that it's a bug but pointed out that your code didn't demostrate it properly.

>
>> Anyway, it doesn't make much sense to search on Null because you know that you wouldn't find anything.
>
>1. If i write generic search class i need to cut the search for any null values:
>
>IF ISNULL(m.searchValue)
>  GO BOTTOM
>  SKIP
>ELSE
>  SEEK m.searchValue
>ENDIF
>IF FOUND()
>ENDIF
>* this for KEYMATCH,SEEK,INDEXSEEK,.... and for RUSHMORE optimization ?
>

>
>2. If this is true, why SQL Server support this ?

What's true and what SQL Server supports? There's no SEEK command in SQL Server.

>
>3. In fact VFP search NULL on index not nullable.
>
>SET NULL ON
>
>CREATE CURSOR MasterTable ( rid I AUTOINCR UNIQUE,Texto C(50) NOT NULL)
>INSERT INTO MasterTable (Texto) VALUES ('testo 1')
>INSERT INTO MasterTable (Texto) VALUES ('testo 2')
>
>CREATE CURSOR ChilrdTable ( rid I AUTOINCR UNIQUE,linkValue I)
>INSERT INTO ChilrdTable (linkValue) VALUES (1)
>INSERT INTO ChilrdTable (linkValue) VALUES (NULL)
>
>* SELECT search NULL on index not nullable !!!!
>cRush=''
>SYS(3054,11,'cRush')
>SELECT CH.rid,CH.linkValue,MT.Texto FROM ChilrdTable CH 
LEFT JOIN MasterTable MT ON MT.rid=CH.linkValue INTO CURSOR r1
>? cRush
>MESSAGEBOX('SELECT search NULL on index, and return NULL record')
>
>ON ERROR MESSAGEBOX(MESSAGE()+CHR(13)+'LOOKUP not support NULL, ignore error and continue')
>SELECT CH.rid,CH.linkValue,LOOKUP(MasterTable.Texto,CH.linkValue,MasterTable.rid) Texto 
FROM ChilrdTable CH INTO CURSOR r2
>ON ERROR
>
>SET ORDER TO 1 IN MasterTable
>SELECT ChilrdTable
>SET RELATION TO linkValue INTO MasterTable
>SCAN
> ? linkValue,MasterTable.Texto,EOF('MasterTable')
>ENDSCAN
>MESSAGEBOX('RELATION search NULL on index, and go EOF() for NULL')
>
>


I've no idea what you were trying to show with above code.

>VFP need a complete, coherent, support for NULL.

Cannot agree more.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform