Subject Re: [IBO] Assigning text to a binary blob field
Author Helen Borrie
At 11:33 AM 20/12/2006, you wrote:
>I inherited a database where they created a blob field as type 2.

Blob sub_type 2 is a system subtype. It should NEVER be applied to
user data. User-defined subtypes should have negative numbers.

>have to live with it for the moment. I need to store an XML schema in
>the field. I am also doing this all in code, so do let me know if I
>need to type cast the the blob field

You can't typecast blobs in SQL. However, you could try subtyping
your IB_ColumnBlob to IB_ColumnMemo.

>I am using a TIB_Query. Here is the stub of the code.
> FIB_Insert.SQL.Clear;
> FIB_Insert.SQL.Add('1, :pJNUM, :pUNMAPPED_DATA, 0 ) ');
> FIB_Insert.Prepare;
> FIB_Insert.ParamByName('pJNUM').AsInteger := FVacTrackInfoRcrd.JNUM;
> FIB_Insert.ParamByName('pUNMAPPED_DATA').Assign(tmpStrList.Text);
> FIB_Insert.Execute;
>I guess what I would like to do is Create a TStringList object, layout
>the XML text, and use the assign method to save the text into the binary
>blob. Will that work?

Almost. However, you don't use Assign to assign strings to
blobs. Assign the default property of the tmpStrList (its Strings
object) directly and you're done:


As a general tip, stay clear of the Text (and CommaText, etc.)
property of stringlists around SQL.