Dennis Cote: You can't truncate or resize a blob, but you can replace it with another blob with a different size. Your problem is that you don't know the size of the compressed blob until after you have done the compression (Note truncation may not always work if the compressor actually ends up expanding a previously compressed file).
If you can get the compressed size of the file (i.e. by doing a dummy compression with output sent to a null device) you can then set the size of the blob correctly before you start writing to it. It is not so effective to read the file twice - the first time to check the compressed size and the second pass - to do the actual streaming in the blob. That is what I am trying to avoid. What do you mean with: "... but you can replace it with another blob with a different size."? Is it possible to store the file in a bigger blob and then replace the blob with smaller one without to copy the raw blob data? Thank you for the help! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Cote Sent: Wednesday, April 23, 2008 5:29 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] Blob truncation [EMAIL PROTECTED] wrote: > Is there a way to truncate a blob (for example set it size to the file > size before compression and after inserting the compressed data to > truncate the unused blob space)? Or it is possible to change the blob size > "on the fly"? > > Any help is very welcome and thank you in advice! > Please don't hijack threads on other topics. http://en.wikipedia.org/wiki/Thread_hijacking You can't truncate or resize a blob, but you can replace it with another blob with a different size. Your problem is that you don't know the size of the compressed blob until after you have done the compression (Note truncation may not always work if the compressor actually ends up expanding a previously compressed file). If you can get the compressed size of the file (i.e. by doing a dummy compression with output sent to a null device) you can then set the size of the blob correctly before you start writing to it. HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users