Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: CAST C,V,Q it is bounded to 254 bytes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
BUG: CAST C,V,Q it is bounded to 254 bytes
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01028603
Message ID:
01028603
Vues:
55
Self CAST has to be invariant,
that is the operation done on an expression that the value converts in it
same type has to return the same value of departure;
this is the first rule of a function of conversion type,
and this is seen by the diagonal of the chart of documentation,
the diagonal has "F" in all the values.

Well, since CAST refers to an expression and not to a Field,
they don't have to be us the tied up restrictions to the fields of a chart.
When CAST is used with a "C,V,Q" VFP imposes
how limit to the length nFieldWidth the maximum length of a field.
The limit that has to be imposed is 2^31-1, not 2^24-32 (engine max buffer size),
because it is possible to load a variable with more than 2^24-32 bytes.

Repro:
CLEAR

? InvariantCast(SPACE(254))
? InvariantCast(SPACE(255))  && this fire a error

? InvariantCast(0h+SPACE(254))
? InvariantCast(0h+SPACE(255))	&& this fire a error

PROCEDURE InvariantCast(x)
return x==CAST(X AS (VARTYPE(X))(LEN(X)))
Then:
X=SPACE(3000)
? VARTYPE(CAST(m.x AS W))

* but it is impossible to impose a greater length of 254
? CAST(m.x AS Q(300))

* Of course, There are many workaroundes , but none can overcome 2^24-32

? LEN(CAST(LEFT(m.x,300) AS W))

* more 2^24-32 bytes conversion
? LEN(CAST(FILETOSTR(GETFILE("","","",0,"Load a file with more than 16Mbytes")) as w)) 
Répondre
Fil
Voir

Click here to load this message in the networking platform