I was wondering if it would be possible (in future versions?) to ZIP a BLOBfile without having to save the BLOBfile to disk, zipping the file, and saving the zipped file back to a BLOBfile. (and also the other way around, unzipping a BLOBfile)
this so save valuable time and resources ...
Something like this should work:
I don't understand what a "BLOBfile" is, but I'm assuming it has to do with a binary field in a SQL Server database? In any case, the Chilkat Zip ActiveX (I assume if it's SQL Server, then you're using the ActiveX?), the Chilkat Zip API provides OpenFromMemory and WriteToMemory methods to read and write .zip archives from memory. Given this, the only task is to determine how to pass the binary data from a database field to an ActiveX method, and the reverse: how to save the returned binary data from an ActiveX to a database field.
I don't actually know the answer to that question. I may involve using a temp table as shown here for getting a long string property: http://www.example-code.com/sql/default.asp
However, in any programming language, NEVER treat binary data that does not represent actual characters as a string (i.e. never treat the binary output of encryption, or image data, or the binary data of a compressed file format such as a .zip as a string). The reason is that you never want anything to be trying to interpret those bytes as characters encoded according to some charset (such as utf-8, iso-8859-1, etc.) I say this because whatever the solution, it would involve a database field that is NOT a string, but must be something that represents binary data.
thanks for your answer.
a BLOB is a file (txt, xml, pdf, ...) stored in a database.
Now I have to convert the BLOB to a physical file on disk, zip it, and convert it back to a BLOB and store it in the database again. And this takes time ...
Works just great !! Just had a little trouble with the return of the WriteToMemory-method, but at the moment it works ...
Thanks a lot !!