Subject | Re: [IBO] TIB_DSQL |
---|---|
Author | Helen Borrie |
Post date | 2004-02-23T21:56:20Z |
At 07:17 PM 23/02/2004 +0000, you wrote:
While you can do
Insert into atable (..., aBlob,...)
values (..., 'some text', ...) (which Firebird will massage into a blob)
it's not possible to pass a string into a blob at the client.
If you have the blob text in a TStrings (such as Memo.Lines, as you have),
in IBO you can just assign the TStrings directly to the blob and IBO will
take care of streaming it into a blob:
Ins_Table.ParamByName('MyBlob').Assign(Memo.Lines);
For non-text blob types (and text as well) there are several other ways you
can go about it. Usually the most economical is to pull the object into a
TStream descendant ((though not the VCL TBlobstream) and use Assign (as
above) to apply the stream to the parameter object.
Helen
>HiA blob needs a blob.
>
>As mentioned earlier today I'm about to convert from TIBOQuery to
>either TIB_Cursor or TIB_DSQL.
>Now I know how to use TIB_Cursor.
>Thank you both Jason and Lucas.
>
>But now I have a little problem with TIB_DSQL.
>I have some inserts, which I at this point do like this:
>
> Ins_Table.ParamByName('MyBlob').AsBlob := Memo.Lines.Text;
>
>
>But the AsBlob is unknown.
>
>What should I do instead ?
While you can do
Insert into atable (..., aBlob,...)
values (..., 'some text', ...) (which Firebird will massage into a blob)
it's not possible to pass a string into a blob at the client.
If you have the blob text in a TStrings (such as Memo.Lines, as you have),
in IBO you can just assign the TStrings directly to the blob and IBO will
take care of streaming it into a blob:
Ins_Table.ParamByName('MyBlob').Assign(Memo.Lines);
For non-text blob types (and text as well) there are several other ways you
can go about it. Usually the most economical is to pull the object into a
TStream descendant ((though not the VCL TBlobstream) and use Assign (as
above) to apply the stream to the parameter object.
Helen