Subject Re: [firebird-support] Re: Converting A Blob To A String Within A SP
Author Alexandre Benson Smith
Helen Borrie wrote:

>32765. Varchar uses 2 bytes for length attributes.
>
>
>
Thanks for reminding this... Hope don't forget it again :-)

>
>
>>s1 = Substring(MyBlob from 32768 for 65535);
>>
>>
>
>Won't work. "for 65535" says you want to return a string of max. 65535
>bytes, which will overflow a varchar hugely.
>
>
Again.. I *always* mix up how it works

Usually I wrote something like hits:

Substring(MyBlob from 32768 to 65535)
I have a synapse created that substring works as "from position" "to position", not "from position" "this length"

I think just a brainwashing will make me change the way I think about
the substring works.

> >> and what if the blob size is still bigger than that?
>
>Then don't try to use it as a string at all. You haven't indicated why you
>want to do this.....but you might like to make a loop in your SP that
>retrieves successive substrings into *separate* varchar variables and
>returns a (necessarily limited) number of output fields in the return
>values, then have your application code reassemble them somehow. (Which
>seems totally pointless, since it's a heck of a lot easier just to stream
>the whole blob across to a single buffer and have the application handle
>the blob as a whole!)
>
>
>
I think he is trying to use inside SP, What I suspect is that it gets a
piece of a Blob, parse it in some way do the stuff, get the next piece
and do the same all inside the SP...

>
>./heLen
>
>
thanks for the points I always learn here every day !

see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br