A Binary Large OBject (BLOB) is usually a collection of binary data stored as a single entity in a database management system. This type of channel is used only to display images.

1 Blob Channel definition

Select the Blob option in the Channel type. The example is going to show an image contained in a web page, so it has been used a XSQL script to obtain the data.

The blob channel can only show a single image, so that the outcome of the script or the query can only be one. In the case of the query the resultset must contain a single row and a single column.

Script commands for the example:

Copy
<call>
<![CDATA[
<xsql-script name='traffic_camera'>
    <body>
    
    	<!-- 
    	http://www.bcn.cat/transit/ca/cameres_pagina_22.html 
    	The image of the camera is constantly updated
    	-->

        <set name='m_time_str'>
            <date.format format='yyyyMMddHHmmss'><date.current/></date.format>
        </set>

        <set name='m_img_url'><add>
            <string>http://www.bcn.cat/transit/imatges/RondadeDaltSantGervasi.gif</string>
            <string>?time=</string>
            <m_time_str />
        </add></set>

        <return>
            <http.connection.read raw='true'>
                <http.connection url='#m_img_url' />
            </http.connection.read>
        </return>

    </body>
</xsql-script>
]] >
</call>

1.1 Column headers

In the blob channels, it is not necessary to define the any channel header.

1.2 Output Fields

In the output field the user has to add the column. In this script case, table and column have been automatically named by the application when the script has been executed for the first time.

1.3 Result

This channel will show the image result of the script: in this case the uptdated camera image of the web page http://www.bcn.cat/transit/imatges/RondadeDaltSantGervasi.gif.

1.4 Blob from a database

If our database contains images, this channel can show them with certain SQL statements.

The SQL statement for this example is:

Copy
<select>
    <columns>
        album_img
    </columns>
    <from table="album_images">
    </from>
    <where>
        albumid = 1
    </where>
</select>

In the output Output field the user has to add the column. Remember that the resultset must contain a single row and one column. No Column Header are needed.

As a result, the channel shows the album image of the database identified with the number 1: