Loading Images from Database BLOB Columns



In Profound UI version 6 fix pack 3.0 and newer its possible to load the contents of an image directly from a Binary Large Object (BLOB) column in a database table.   A BLOB is a feature of the database that can store a large amount of binary (non-text) data, and is commonly used to store pictures.  Currently, Profound UI understands JPEG and PNG type pictures.

This support is provided by the following properties:

  • blob table - this specifies the database table (sometimes called "file") that contains the BLOB column. 

  • blob column - the name of the column ("field") that contains the BLOB.

  • blob selection criteria - controls which row ("record") is selected.  For best performance, we recommend using a selection criteria that returns only one row.

  • blob parameter value - values of any parameters in the selection criteria.  If there are no parameters, this property is not used.

Behind the scenes, Profound UI will use these fields to generate an SQL statement that is used to read the BLOB.  The SQL statement will be built as follows:

SELECT BLOB-COLUMN FROM BLOB-TABLE WHERE BLOB-SELECTION-CRITERIA

You can use any value for the blob properties that will be understood by the database.  For example, the BLOB selection criteria can have multiple ANDs and ORs, etc as would be appropriate in the database's WHERE clause.  Likewise, the blob table can contain a library, schema or database name that would be valid in the database FROM clause.

The SQL statement should return one column from one row.  If you attempt to provide multiple columns, you will get an error at runtime.  If you attempt to provide multiple rows, Profound UI will only use the first row returned and will ignore the others.  The SQL query will perform better, however, if you use the "blob selection criteria" to limit the output to a single row.