Exporting BLOB Data |
![]() ![]() ![]() |
RelDBQueryDataService and RelDBQueryProcess support support exporting binary data stored in BLOB (Binary Large Object) type table fields to file system. By using this feature; with one query, the data stored in other type of fields can be retrieved and the binary data stored in BLOB fields can be exported to external files so that the web browsers can directly access them. An Export BLOB Data Definition can be made in the value of a query parameter. The definition must be enclosed with SQL comment symbols. Definition Syntax: _EXPORT_BLOB_DATA(export-directory; key-fields; blob-fields; change-detection-fields)
Parameters export-directory The name of the directory where the BLOB fields will be exported to. Although this definition can be made absolute or relative to the root directory of the web application, generally the using the relative definition makes sense; because the export directory should be accessible by the browsers.
key-fields The exported files should be named uniquely in order to prevent the file name collision. Therefore this parameter should be given one or more field names (separated with commas) whose values build a table based unique identity.
blob-fields The name of the BLOB fields whose values will be exported to external files. One or more (separated with commas) BLOB field names can be given. After each BLOB field name an ':' character and the extension name of the export file should be specified. This extension name is actually defines the content type of the binary data stored in the BLOB field.
change-detection-fields This optional parameter is used to detect a change in the current record. This way unnecessary exporting of the BLOB fields can be avoided. If one or more fields are available whose content can indicate the change in the current record you can define the names of the fields in this parameter. If it is not defined, then the BLOB export will be performed always.
Examples::
The binary data existing in BLOB field PICTURE is exported to files {ID}.jpg under {APPLICATION_ROOT}/product_pictures directory. The exporting is done always.
The binary data existing in BLOB field PHOTO is exported to files {NAME}{FIRSTNAME}{DEPARTMENT}.jpg under {APPLICATION_ROOT}/photos directory. The export requests for the same record will be by-passed as long as the value of the UPDATE_DATE column is the same.
The binary data existing in BLOB fields PROPOSAL and DEMO is exported to files {ID}.doc and {ID}.ppt under {APPLICATION_ROOT}/documents directory. The export requests for the same record will be by-passed as long as the value of the UPDATE_DATE column is the same.
The BLOB Export definitions can be processed conditionally where necessary.
|