Subject RE: [ib-support] Firebird, Stored Procedures, and BLOB parameters
Author Thomas Steinmaurer
Alan,

> "I must admit that the blob input parameter is only used within an INSERT
> INTO
> statement then, inserting into a column which is based on subtype 0, so
> independent what blob data is coming through, the inserted blob is always
> stored in a subtype 0."
>
> huh??
>
> IN the statement
> update tbljobschedule set notes='this is a blob' where jobind=3
> do you do something like
> update tbljobschedule set notes SUB_TYPE 1 SEGMENT SIZE 80='this is a blob'
> where jobind=3
> ??? How do you do this?

I've said that I'm using an insert statement. For example:

I have the following table.

RECREATE TABLE IBLM$COLUMNLOG
(
ID INTEGER NOT NULL,
LOGTABLE_ID INTEGER NOT NULL,
SPALTE VARCHAR( 31) COLLATE ISO8859_1,
ALTERWERT VARCHAR( 255) COLLATE ISO8859_1,
NEUERWERT VARCHAR( 255) COLLATE ISO8859_1,
ALTERWERTBLOB BLOB SUB_TYPE 0 SEGMENT SIZE 80,
NEUERWERTBLOB BLOB SUB_TYPE 0 SEGMENT SIZE 80
);

and the following procedure.

SET TERM ^^ ;
CREATE PROCEDURE P_INSERTINTOIBLM$COLUMNLOG (LOGTABLE_ID Integer, SPALTE VarChar(31), ALTERWERT VarChar(255), NEUERWERT
VarChar(255), ALTERWERTBLOB BLOB, NEUERWERTBLOB BLOB)
AS
BEGIN
INSERT INTO IBLM$COLUMNLOG (ID, LOGTABLE_ID, SPALTE, ALTERWERT, NEUERWERT, ALTERWERTBLOB, NEUERWERTBLOB)
VALUES (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :LOGTABLE_ID, :SPALTE, :ALTERWERT, :NEUERWERT, :ALTERWERTBLOB, :NEUERWERTBLOB);
END
^^
SET TERM ; ^^


The procedure is used in a trigger with:

EXECUTE PROCEDURE P_INSERTINTOIBLM$COLUMNLOG (GEN_ID(GEN_IBLM$COLUMNLOG_ID, 1), :VAR_ID, 'COMP', OLD.COMP, NEW.COMP, NULL, NULL)

where COMP is a blob column.

So, the blob input parameters of the stored procedure are simply
passed to the insert into statement, inserting the blob data into
a blob subtype 0.

Anyway, Firebird is capable to assign a text to a blob directly.
Does this only work for you, when you have created a blob column
using subtype 1 and not for subtype 0?

Regards,
Thomas