Subject RE: [IBO] Passing Blobs to an Insert or Update Query
Author Jason Wharton
Please don't use any hard typecasts if you can help it. They just turn
around and bite you. There ought to be a LoadFromFile method without having
to do that. You might also use a TFileStream and then use the Assign method
to assign from it.

Jason Wharton

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, June 07, 2004 9:25 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Passing Blobs to an Insert or Update Query


At 03:18 AM 8/06/2004 +0000, you wrote:
>Hmmm.... I can't seem to pass blobs to an update or insert query.
>Any ideas?
>
> sQ :=
> 'INSERT into SIGNATURES ' +
> '(SINVLOOKUP, BARCODE) Values '+
> '('+ QuotedStr(sInvLookup) + ', :Barcode)';
> Active := False;
> SQL.Clear;
> SQL.Add(sQ);
> TBlobField(ParamByName('BARCODE')).LoadFromFile(sJPEGFile);
> Active := True;

I seem to recall there's a problem with TBlobField due to some dependency
between the vcl units db.pas (which the TIBO components use) and DBTables
(which TIBO does not use).

Try

TIB_ColumnBlob(ParamByName('BARCODE')).LoadFromFile(sJPEGFile);

An unsolicited comment on your code here: why waste resources by assigning
SQL at runtime and not parameterising *both* of these inputs?

Helen