Subject RE: [IBO] Basic blob prob - simple tests
Author Claudio Valderrama C.
I think it's AS DESIGNED.
A procedure expects a BLOB_ID... one that works.
When a procedure call statement is prepared, it's assumed the caller
provides a blob identifier, more even if it's done in the SELECT way. I can
see IBO sending a null blob pointer (identifier). So, by the time the
insertion is done in the table inside the proc, the memo's contents that
were sent aren't bound to any blob, hence you store nothing in the blob
column.
When a parameterized insertion is done, the server just creates a blob (as
requested by the app) hence the contents sent from the client are assigned
to it and such blob is "attached" to the record. This is a bare bones
explanation why first case fails and second one succeeds.

Some workarounds:
- call the IB API and create a blob, put info on it and pass the blob id to
the stored procedure. If you want it to be transparent, IBO would need to
provide some call to easy the issue.
- prepare the typical INSERT command and go, as you already know.
- if you don't need a parameterized statement and are building your command
on the fly because it's not intensively used, then you can do a direct
insertion on firebird:
INSERT into tbl(intfield, blobfield) values (5, 'this is a literal');
If your customer or company is using IB, then this is not an option.

C.

> -----Original Message-----
> From: news@... [mailto:news@...]On Behalf Of Paul
> Hope
> Sent: MiƩrcoles 11 de Julio de 2001 7:30
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Basic blob prob - simple tests
>
>
> I have carried out some simple tests on this problem and am even more
> perplexed.
>
> I have an IB_Cursor with a transaction set to autocommit.
>
> I have a table 'do_header' which has a primary key 'do_no' and a blob
> sub_type 1 'delivery_address'.
>
> if I
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> with ibc do
> begin
> SQL.Text:='Insert into do_header(do_no,delivery_address)values(1,:da);
> ParamByName('da').Assign(memo1.Lines);
> ExecSQL;
> end;
> end;
>
> This works fine.
>
> if I create a stored procedure
>
> create procedure testda
> (dono integer,
> da blob sub_type 1
> )returns(
> mess varchar(30))
> as
> begin
> insert into do_header(do_no,delivery_address)values(:dono,:da);
> mess='OK';
> suspend;
> end
>
> and then
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> with ibc do
> begin
> sql.text:='select * from testda(4,:da)';
> ParamByName('da').Assign(memo1.Lines);
> Open;
> label1.caption:=fields[0].asstring; // this returns 'OK'
> end;
> end;
>
> it creates the new record with do_no=4 but the delivery address
> is empty :-(
>
> Have I missed something simple here, am I going loopy or is there
> a problem?
>
> Regards
> Paul
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>