Fabio,
Thanks, I really appreciate the info.
>>Why TYPE() and VARTYPE() returns different results for field type
BLOB>>
>>
CLEAR
>>CREATE TABLE Test (bugfield W)
>>INSERT INTO Test VALUES (FILETOSTR(HOME()+'beautify.app'))
>>? TYPE('bugfield')
>>? VARTYPE(bugfield)
>
>because bugfield in VARTYPE(bugfield) it is considered
>like a memory expression;
>on VFP a binary memory variable have "Q" as datatype.
>TYPE('bugfield') it distinguishes the fields instead
>
>
>CREATE cursor Test (bugfield W)
>APPEND BLANK
>clear
>? TYPE('bugfield'),TYPE('bugfield+0h')
>? VARTYPE(bugfield),VARTYPE(bugfield+0h)
>
>
>This is not a bug.
>
>A bad design there is because if a variable
>it contains a varbinary "Q" of length 10000,
>this cannot be inserted in
>a field Q, but it must be inserts
>in a field W (blob);
>certainly this is not the ugliest thing of VFP.
>
>The same is true for a field Memo.
>
>Another point is this:
>with a large value, TYPE() can to be faster:
>
>clear
>CREATE cursor Test (bugfield W)
>APPEND BLANK
>test(1,1000000)
>test(1000000,5000)
>
>PROCEDURE test(n,k)
> replace bugfield WITH REPLICATE('a',m.n)
> t1=SECONDS()
> FOR k=1 TO m.k-1
> =TYPE('bugfield+""')
> NEXT
> t0=SECONDS()-t1
> t1=SECONDS()
> FOR k=1 TO m.k-1
> =VARTYPE(bugfield+"")
> NEXT
> t01= SECONDS()-t1
> ? "lenght =",n at 10
> ?? "type =" at 25,m.t0 ;
> ?? "vartype =" at 50,m.t01
> ?? "ratio = ",TRANSFORM(ROUND(m.t0/m.t01*100,3)),'%'
>
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst