Subject | Re: [firebird-support] Blob filter doc/help/tut/example for Delphi |
---|---|
Author | Ivan Prenosil |
Post date | 2005-02-08T12:04:35Z |
"Urs Liska" wrote:
CREATE PROCEDURE P RETURNS (
BBLR BLOB SUB_TYPE BLR,
BTXT BLOB SUB_TYPE TEXT,
BBIN BLOB SUB_TYPE 0
) AS
BEGIN
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BBLR;
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BTXT;
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BBIN;
END^
SET BLOB ALL;
EXECUTE PROCEDURE P;
The RDB$TRIGGERS.RDB$TRIGGER_BLR field is of type BLOB SUB_TYPE BLR (=2).
When you assign it to BTXT variable (which is BLOB SUB_TYPE TEXT), the result will
still be binary blr, not its text representation !
The BBLR output variable will show the text representation of blr code,but it is because
the _client_ (i.e. isql application in this case) requested calling the proper blob filter !
Ivan
http://www.volny.cz/iprenosil/interbase/
> Ivan Prenosil schrieb:You can try it yourself, simply execute this procedure in ISQL:
>>>Did I misunderstand something there? I thought that blob filters were
>>>implicitly invoked when dealing with columns oder PSQL variables of
>>>different blob subtypes, e.g.
>>>
>>>FOR
>>>SELECT tif_blob
>>> FROM pic_table
>>> INTO :jpg_var
>>>DO...
>>>in a SP (with a corresponding filter declarde)
>>>???
>>
>>
>> No, this will not invoke blob filter. (unless somebody implemented it
>> in the latest version and did not tell to others ...)
>>
>> The only way is using BPB when opening blob from client ...
>>
>> Ivan
>> http://www.volny.cz/iprenosil/interbase/
>>
>
> "The Firebird Book" (p.771) states that after declaration of a filter
> "in your SQL or PSQL, all you need to invoke the conversion
> automatically is a variable or database column, declared as BLOB
> SUB_TYPE xx ... and a destination variable or column of SUB_TYPE
> yy to receive the converted document." (xx and yy being the SUB_TYPES
> the filter is declared for.
>
> What's correct then?
> I can't try without a working filter. And I won't learn to write a
> filter when I can't use it...
CREATE PROCEDURE P RETURNS (
BBLR BLOB SUB_TYPE BLR,
BTXT BLOB SUB_TYPE TEXT,
BBIN BLOB SUB_TYPE 0
) AS
BEGIN
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BBLR;
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BTXT;
SELECT RDB$TRIGGER_BLR FROM RDB$TRIGGERS WHERE RDB$TRIGGER_NAME='RDB$TRIGGER_2' INTO BBIN;
END^
SET BLOB ALL;
EXECUTE PROCEDURE P;
The RDB$TRIGGERS.RDB$TRIGGER_BLR field is of type BLOB SUB_TYPE BLR (=2).
When you assign it to BTXT variable (which is BLOB SUB_TYPE TEXT), the result will
still be binary blr, not its text representation !
The BBLR output variable will show the text representation of blr code,but it is because
the _client_ (i.e. isql application in this case) requested calling the proper blob filter !
Ivan
http://www.volny.cz/iprenosil/interbase/