Icon View Incident Report

Minor Minor
Reported By: Steve Gill
Reported On: 1/29/2015
For: Version 2.18 Build 3
# 4150 Saving an Image to a BLOB Column Using a Stored Procedure Truncates the Image Data

The following code saves an image to a database table using a stored procedure.

PhotoStream is a TMemoryStream. When I check the size of the photo just before saving it to the database, the size is 61177 bytes. If I save the stream to file as a check, it's a valid image.

After the stream is written to the table the BLOB column size is only 18 bytes. When I read the BLOB field back out of the table it is 18 bytes.

Needless to say it is no longer a valid image.

RAD Studio XE6
Elevate DB 2.18 Build 3
CharacterSet: csUnicode

PhotoStream.Position := 0; 
spUpdateAddressBookEntry.ParamByName('PPhoto').LoadFromStream(PhotoStream, ftBlob);



Comments Comments and Workarounds
The issue would occur when the Params property was pre-populated, and not populated via a Prepare call. In such a case, ElevateDB would re-assign the data type to the parameter and cause Delphi to reset the binary parameter data.

The workaround was to manually call the Prepare method *before* populating the parameters and calling the stored procedure.


Resolution Resolution
Fixed Problem on 1/30/2015 in version 2.18 build 4


Products Affected Products Affected
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image