What are BLOB subtypes?

Blobs can store infinite amounts of data. They can be used to store text, images, videos, audio, or any other kind of data. Retrieving and writing data to blobs is done with separate functions, so it is usable to have some basic string (CHAR, VARCHAR) operations available for textual blob. Therefore the sub types were added (as blob is a type). The subtypes are:

0 - binary data (image, video, audio, whatever)
1 - text (basic character functions work)
2 - BLR (used for definitions of Firebird procedures, triggers, etc.)

User applications should only use subtypes 0 and 1.

Since Firebird 2.1 you can use the following builtin string manipulation functions on text (subtype 1) blobs: LEFT, RIGHT, SUBSTRING, TRIM, CHAR_LENGTH, REPLACE, TRIM, LPAD, RPAD.

Please note that most these functions load entire blob contents into memory, so make sure your server has enough RAM to store the data. If you need to know for sure, look at the function description in Firebird manual.

Some UDF function libraries built before Firebird 2.1 use the same function names (LEFT, TRIM, etc.) and those would override internal functions. The functions in those libraries do not support blobs. So, if you find that some of the functions does not work with your text blobs, check whether there is an UDF defined with the same name. To fix this problem, you can drop the UDF function are declare it again with a different name.

Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.

Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

 Installation and setup
 Backup and restore
 Connectivity and API
 Errors and error codes