Page 1 of 1

Blob Streams and Blob failures

Posted: 13.04.2011, 07:51
by instinctfx.net
Ladies and Gents,

Im having a real pain in the a** time trying to get a dataset to upload a blob.

SQL SERVER EXPRESS 2005 (win2k environment in a virtual machine)

This is the code:
[font=Courier New]

if not Locate('FIELDNAME', FRef, [loCaseInsensitive]) then
begin
Insert;
vS := tblGetPhoto.CreateBlobStream(GetPhotoIMAGE_DATA, bmWrite);
try
vS.Seek(0, soBeginning);
vS.CopyFrom(vUpload, vUpload.Size);
finally
FreeAndNil(vS);
end;

Post;

end;

[/font]

Now this same process and other types, works on other tables except this new table im working on.

Another image is uploaded to a separate table with no problems prior to this code executing, BUT when it comes time to upload the second image to the next table, it just skips over it as if there was nothing there (Yes there is image data in the stream).

Other fields in the table work fine except the varbinary field im trying to upload an image to in this table.

Any ideas why this would not be uploading to the blob field? Its just setting it to null.

No errors are raised either.

Posted: 14.04.2011, 14:52
by trupka
Hi,
I'm not sure I completely understand your problem but, did you try something like this:

Code: Select all

with ZQuery do
  begin
    Insert;
    TBlobField( fieldByName('the_blob')).LoadFromFile('THE_FILE');
    Post;
  end;

Posted: 15.04.2011, 01:38
by instinctfx.net
Ive tried that too to no avail.

For some reason the blob field refuses to put anything into it just on that table alone.

Weird issue that i cant seem to get around. Worst part is, its the last thing before release. Doh!

Posted: 15.04.2011, 06:46
by instinctfx.net
Just tried this bit of code from simple database editing tool I have and this code fails too!

I check the readonly state on the TBlobField and cannot figure out why this tables blob is being as ReadOnly True.

Code: Select all


      tblData.Edit;
      TBlobField(dbTextEdit.Field).LoadFromFile(vOpen.Filename);
      tblData.Post;

Posted: 15.04.2011, 06:58
by instinctfx.net
Ive even tried recreating the damned table.
I can save data to the other fields except the damned blog

Posted: 19.04.2011, 10:49
by trupka
I did few tests with current testing version and there is a bug with blob handling and ADO. Can you provide some simple example? I assume you used varbinary for blob data? What Delphi / Zeos version are you using?

Posted: 19.05.2011, 21:51
by mdaems
instinctfx.net,
Did you try commenting out the first blob update? Maybe the problem is in setting two blobs?

Mark