Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: SET NEAR and integer seek
Message
De
08/06/2005 19:17:50
 
 
À
08/06/2005 18:22:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01021240
Message ID:
01021659
Vues:
38
>Not a bug - By Design.
>

Then a bad design.

>Allow me to explain. Since the target field type is an Integer, a SET NEAR ON seek result (or RECNO(0)) will return the lowest value if the SEEK value is within the allowed lower bounds of an integer, otherwise there is no "near" value; and the reverse is true at the outer bounds.
>

A correct SET NEAR implementation,
grouping all the data out of allowed bound range to the lowest or outer bounds.

Why ? Because on VFP a numeric expression never it is a integer.
Then, with set near i must to use SEEK MIN(MAX(exp,-2147483647),2147483647).
No good for me.

Infact, what the VFP have inherited from the original FoxPro (than did not have the Integer ago)
do that what it must make.

Look after

>For example, if you convert the field in your example to N(14,0) you won't see any "zero" recno() values because the seek is now within the allowed bounds of the target field type.
>

Observe this:
CLEAR

? "FF     FOUND() RECNO(0) EOF()"
CREATE CURSOR DDD (FF N(5,0))
* ALLOWED BOUNDS

INSERT INTO DDD VALUES (-9999)
INSERT INTO DDD VALUES (+9999)
INDEX ON FF TAG TT
SET NEAR ON
SEEK -999999999999 && is this within the FF' allowed bounds ? NO
? FF,FOUND(),RECNO(0),EOF() AT 25     && -9999 .F.   1 .F.
SEEK +999999999999 ORDER 1 DESCENDING && is this within the FF' allowed bounds ? NO
? FF,FOUND(),RECNO(0),EOF() AT 25     && -9999 .F.   1 .F.
Then, or Integer have a Bug ( i say this )
or the N(5,0) have a bug ( you say this )

1 Bug for me, in any case

>Now in your reply you posted:
>
>CREATE TABLE bb (aa i)
>INSERT INTO bb VALUES (0x80000000)
>
>The hex value translates to 2147483648, which is one outside the valid Integer range. So the INSERT should not work (REPLACE doesn't with this value), but does, although LOCATE or any other function won't identify the entry.
>

I known the I32 range

>So you found a bug, but not the one you thought you found <g>
>

Then don't fix it please. It is very useful! Also why this happens with the N() AND B()
* INTEGER

CREATE CURSOR DDD (FF I)

INSERT INTO DDD VALUES (-9999999999E999)  && this is a out of range value, NO ERROR
BROWSE
replace ff WITH -2147483648		  && this fire a error
BROWSE
UPDATE DDD SET FF = -9999999999E999      && this is a out of range value, NO ERROR
BROWSE

* FLOAT

CREATE CURSOR DDD (FF N(5,0))

INSERT INTO DDD VALUES (-9999999999E999) && this is a out of range value, NO ERROR
BROWSE
replace ff WITH -999999					 && this fire a error
BROWSE
UPDATE DDD SET FF = -9999999999E999      && this is a out of range value, NO ERROR
BROWSE

* DOUBLE

CREATE CURSOR DDD (FF B(15))

INSERT INTO DDD VALUES (-9.999999999E999)  && this is a out of range value, no error
? FF
BROWSE
replace ff WITH -9.9884656743115E999		  && this is a out of range value, no error
BROWSE
UPDATE DDD SET FF = -9.999999999E999   && this is a out of range value, no error
BROWSE
John, you can remember my bugs score to me, I have lost it :-)

PS Currency is OK ( - $922337203685477.5808 it is checked )

Hi. Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform