Subject Re: [ib-support] Help with query
Author Helen Borrie
At 08:45 PM 15/01/2003 -0500, you wrote:
>Hello,
>
>I figured out how to save a BLOB to an Interbase database, but I am
>running into a problem due to the contents of the Blob.
>
>I am using the following code to insert the blob:
>
>MessageBody.SaveToStream(MsgStream);
>DMMySQL.QryStoreBody1.ParamByName('PartID').Value:=JobParams;
>(DMMySQL.QryStoreBody1.Params[1] as
>TParam).LoadFromStream(MsgStream,ftBlob);
>
>The problem is that the blob is an encoded NNTP message. I am getting an
>error "invalid token '" when I try to do the insert. I tried doubling
>the "'" characters, and this does work for some text, but it fails on
>others. How can I get Interbase to accept the entire blob without having
>to "doctor" it first?

In InterBase, there are different kinds of blobs.

Blob sub_type 0 doesn't care what is in the blob. It just has to be a blob.

Blob sub_type 1 is hooked to a filter that expects ascii text. As long as
the data is all ascii text, it doesn't care about the content, e.g. such
things as escaping apostrophes and what have you.

You can put text data into blob sub_type 0 but you can't put binary data
into blob sub_type 1.

I wouldn't be too categorical that a wrong blob sub_type is causing your
problem, though. A message containing "invalid token" usually indicates
bad SQL. Are you sure that you are passing a blob and not a string? If
your MsgStream argument is not a TBlobStream, your TParam.LoadFromStream
call won't be valid.

Firebird can accept a string as input to a text blob, but InterBase can't...

What is the *full text* of the error message you are getting?

heLen