Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving OLE Column Blob back to disk

Status
Not open for further replies.

dalefuller

Programmer
Oct 7, 2010
2
US
We have a bunch of bitmaps that have been saved as blobs via Column OLE objects to the DB (Oracle). Now we need to have the ability to save the blobs back to disk as a usable file. As is, they contain minimal wrapper info and are not recognizable to the host server app (MS-Paint) when saved to disk via SelectBlob, etc.
Need to be able to do this programmatically.

Would be nice to be able to do something like...

blob lblob
oleobject lole

selectblob ... into :lblob ...

lole = connecttonewobject("Paint.Picture")

lole.objectdata = lblob

lole.<whatever>.saveas("filename","bmp")

but this fails at a couple different points.
- MS-paint doesn't like to be a ole server in this context.
- objectdata isn't a property of oleobjects.
- and who knows what the saveas function would actually look like.
But I think you'll get what I would like to do.

Any suggestions would be greatly appreciated.
Thanks.
 
So are you saying selecting the blob and then saving it to a file does not work?
For example:
Code:
integer li_FileNum
blob emp_id_pic

SELECTBLOB salary_hist INTO  : emp_id_pic
   FROM Employee WHERE Employee.Emp_Num = 100
   USING SQLCA;
li_FileNum = FileOpen("C:\EMPLOYEE\EMP_PICS.BMP",StreamMode!, Write!, Shared!, Replace!)
FileWriteEx(li_FileNum, emp_id_pic)
And then you try to open the file with MSPaint and it don't open?

Matt

"Nature forges everything on the anvil of time"
 
That is correct, Matt. Cutting and pasting an image into a OLE Column Blob and saving to the DB, does not have enough information to be able to exist as a stand alone file. I need a means to add that information that allows it to be a stand alone file.

Thanks
 
What if you brought the blob back into the clipboard buffer? (which sounds like where it came from prior to going to the database). And then pasting the clipboard buffer to an image type control?

I don't know if this will work for you.

Matt

"Nature forges everything on the anvil of time"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top