Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A bug or normal integer operation ???
Message
 
À
01/08/2000 10:21:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00399275
Message ID:
00399283
Vues:
16
>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 >
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform