Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A bug or normal integer operation ???
Message
From
01/08/2000 10:46:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00399275
Message ID:
00399300
Views:
19
>>Some_Id is integer in all tables tested.
>>
select * from tableA a ;
>>  inner join TableB b on a.Some_Id=b.Some_Id ;
>>  where b.Some_Id between 1 and 0xFFFFFFFF
Returns 0 records !!! but :
>>
select * from tableA a ;
>>  inner join TableB b on a.Some_Id=b.Some_Id ;
>>  where a.Some_Id between 1 and 0xFFFFFFFF
>
>Cetin,
>
>The above queries are identical, but see below
>
>Returns n records. This is a problem if you have more joins and have to use a field from any table except first. If you use 0x7FFFFFFF then it works. It doesn't help if you write in hex notation or not. I really could have a value greater than (should I say less than) 0x7FFFFFFF. Any reference to this on MSDN ? TIA.
>>PS: I'm aware that an integer is in the range –2147483647,2147483646. I just can't understand why it works partially.
>
>VFP is kind of strange when it comes 32 bit integers. Unsigned values, are from 0 to 4,294,967,295. However, it appears that the query engine recognizes only signed values, which have the range you mention above. With signed integers, the most significant bit (bit 31) is the sign. Now if this is correct, 0xFFFFFFFF is signed and has the value -1. Which means in your query you're retrieving the ids between 0 and -1. However, I've found that whenever the latter value is less than the first, regardless of data type, even when records exist, a query returns zero records. Since -1 is less than 0...< s >


OK won't try to understand the query engine :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform