Subject | RE: [ib-support] Firebird, Stored Procedures, and BLOB parameters |
---|---|
Author | Alan McDonald |
Post date | 2003-03-25T11:43:46Z |
ok - yeh your insert statement is
"inserting into a blob field value blob parameter"
that's fine..
and it's good that FB can finally
"insert into a blob field value string parameter"
the only problem I had (after I finally got this methodology working) was
when I tested the GEMINI ODBC driver against my code. I had declared one SP
as having an input parameter subtype 0 (binary) and the ADO (JScript)
parameter was declared as text (VARCHAR). The old visigenic driver had never
complained about this but the GEMINI driver (correctly) objected.
But I do always declare my input parameters with a subtype - I never just
declare them as "BLOB" only.
Alan
-----Original Message-----
From: Thomas Steinmaurer [mailto:ts@...]
Sent: Tuesday, 25 March 2003 10:29 PM
To: ib-support@yahoogroups.com
Subject: RE: [ib-support] Firebird, Stored Procedures, and BLOB
parameters
Alan,
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
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
"inserting into a blob field value blob parameter"
that's fine..
and it's good that FB can finally
"insert into a blob field value string parameter"
the only problem I had (after I finally got this methodology working) was
when I tested the GEMINI ODBC driver against my code. I had declared one SP
as having an input parameter subtype 0 (binary) and the ADO (JScript)
parameter was declared as text (VARCHAR). The old visigenic driver had never
complained about this but the GEMINI driver (correctly) objected.
But I do always declare my input parameters with a subtype - I never just
declare them as "BLOB" only.
Alan
-----Original Message-----
From: Thomas Steinmaurer [mailto:ts@...]
Sent: Tuesday, 25 March 2003 10:29 PM
To: ib-support@yahoogroups.com
Subject: RE: [ib-support] Firebird, Stored Procedures, and BLOB
parameters
Alan,
> "I must admit that the blob input parameter is only used within an INSERTblob'
> 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
> where jobind=3I've said that I'm using an insert statement. For example:
> ??? How do you do this?
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
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/