Subject | Re: Adding blobs in SP |
---|---|
Author | sdbeames |
Post date | 2002-09-14T23:59:15Z |
--- In ib-support@y..., Helen Borrie <helebor@t...> wrote:
I was trying to convert my 2 blobs to strings, concatenate them,
then replace the stored blob. I think my problem is with the
concatenation of the CSTRINGs returned by the UDF functions. Is this
approach possible in an SP, or would I have to do it all at the
client?
Cheers,
Steve
> At 12:32 AM 14-09-02 +0000, you wrote:||
> >How can I add two blobs in an SP?
> >This is where I'm up to...
> >
> >alter PROCEDURE INSERT_SUPPLIER (~snip~, Note BLOB, ~snip~)
> >AS
> >~snip~
> > if (f_BlobSize(Note) > 0) then
> > update SUPPLIERS set NOTE = String2Blob(f_BlobAsPChar(NOTE)
> >f_BlobAsPChar(:Note)) where SUPLRNO=:id;another
> >
> >END !!
> >
> >This just clears the blob field!
> >Do I have to convert the CSTRING returned by f_BlobAsPChar() to a
> >VARCHAR somehow first?
> >
> >Using FB1/XP/FreeUDFLib
>
> A blob isn't a string so you can't concatenate two blobs and make
> blob out of them. When a blob is "updated" it is actuallyreplaced, i.e.
> the old BlobID is made null and a new BlobID set to point to thenew blob.
>directly
> Did you know that in Firebird you can actually pass a string type
> to a blob?Thanks Helen,
>
> alter PROCEDURE INSERT_SUPPLIER (~snip~, Note varchar(100), ~snip~)
> AS
> ~snip~
> if (f_StringLength(:NOTE) > 0) then
> update SUPPLIERS set NOTE = f_BlobAsPChar(NOTE)||:NOTE
> where SUPLRNO=:id;
>
> heLen
I was trying to convert my 2 blobs to strings, concatenate them,
then replace the stored blob. I think my problem is with the
concatenation of the CSTRINGs returned by the UDF functions. Is this
approach possible in an SP, or would I have to do it all at the
client?
Cheers,
Steve