Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to protect pic. in blob fields
Message
De
05/10/2011 10:48:11
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
05/10/2011 05:30:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01525343
Message ID:
01525644
Vues:
64
>>>>>
>>>>>FUNCTION XORDATA(data,Key)
>>>>>	RETURN BITXOR(m.Data,REPLICATE(m.Key,CEILING(LEN(m.Data)/LEN(m.Key))))
>>>>>ENDFUNC
>>>>>
>>>>
>>>>This won't work. BitXor() works with integers only, not strings.
>>>>
>>>>Which is a shame - it should.
>>>
>>>
>>>It does work on Blob fields - you may need a cast
>>>
>>>
>>>return bitxor( cast(m.data as blob), cast(otherdata as blob))
>>>
>>
>>Didn't know that - and I need to :).
>>
>>Tried to see what happens if I cast it as varbinary - and it worked the same when I cast only the first parameter. When I cast both, it worked... sort of - the length of the result was 1.
>
>I did a simple test before answering
>
>xx=repl('a', 20)
>yy=repl('b', 20)
>zz= bitxor(cast(xx as blob), cast(yy as blob))
>?zz
>?len(zz) && 20
>
I wasn't clear - when I cast 1st parameter as varbinary and the other as blob, it was fine. When I cast both as varbinary, then only 1st character is returned.

Can't call that a bug, it's a behavior :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform