Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro and evaluate() fire a error with CR on Literals
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00973008
Message ID:
00973158
Views:
21
>>>Are you sure you aren't thinking of EXECSCRIPT()? EVALUATE() is only supposed to operate on a single expression. Macro Substitution isn't supposed to work with more than one line, either.
>>
>>Hi Garrett,
>>
>>Of course!
>>But VFPT don't trap a multiline CR or NL, they have trapped a innoffensive literal CR or NL,
>>it is a character, not a command line separator.
>>The bug it is still present on VFP9.
>>
>>I try another example:
>>
>>CLEAR
>>ON ERROR ?? MESSAGE()
>>
>>? "Expected : 6    Observed VFP8 : 6 VFP9 : Error"
>>? EVALUATE("printLenString([3+5"+CHR(13)+"+2])")
>>
>>? "Expected : 6    Observed VFP8 and VFP9 : Error"
>>? EVALUATE("printLenString([3+5"+CHR(10)+"+2])")
>>
>>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>>? EVALUATE("printLenString([A])"+CHR(13)+"+printLenString([A])")
>>
>>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>>? EVALUATE("printLenString([A])"+CHR(10)+"+printLenString([A])")
>>
>>? "Expexted : Error Observed VFP8 and VFP9 : Cut the code"
>>? EVALUATE("printLenString([A])"+CHR(0)+"+printLenString([A])")
>>
>>ON ERROR
>>
>>PROCEDURE printLenString(s)
>>RETURN LEN(s)
>>
>
>Frank's got it right here, I think: if you look at it as the actual string you're trying to execute, it makes sense.
>
>
printLenString([3+5
>+2])
>
>should fail.
>
>
printLenString([A])
>printLenString([A])
>
>should not. Since EVALUATE() is only supposed to evaluate a single expression, and, as Aleksey says, the end of the line is treated as the end of the string literal, VFP9 is showing the correct behavior.


Hi Garrett, as I say to Aleksey, i known this before to write this thread,
and if you read, i don't say that this is a incorrect fixing,
but only that the ascii 13 is a formal error, than but to me it made much comfortable one to write
MSSQL script.

Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform