Saving Blob data from SQLite database to a file
Posted
by Felipe
on Stack Overflow
See other posts from Stack Overflow
or by Felipe
Published on 2010-04-30T15:27:06Z
Indexed on
2010/04/30
15:27 UTC
Read the original article
Hit count: 321
Hello,
I'm trying to save blob data from a SQLite database (Safari cache: Cache.db) to a file, but for some reason sqlite won't read the whole blob. I eventually would like to do this in ruby, but for now something that works directly in sqlite command prompt is fine. Also, I've read all of the entries that talk about this here on stackoverflow, but most of them only discuss the performance of saving images in blobs and the one entry that does show to save blobs to file is in C# which does not help me. Here is what I've tried:
sqlite> select * from cfurl_cache_response limit 1; 3501|0|945281827|0|http://www.gospelz.com/components/com_jomcomment/smilies/guest.gif|2010-02-24 16:20:07
sqlite> select receiver_data from cfurl_cache_blob_data where entry_ID = 3501;
GIF89a(
A hexdump of the original (guest.gif) file shows that sqlite stops reading the blob after the first null value:
$ hexdump -C guest.gif
00000000 47 49 46 38 39 61 28 00 28 00 f7 00 00 f1 f5 fd |GIF89a(.(.......|sqlite> .output test.gif
sqlite> select receiver_data from cfurl_cache_blob_data where entry_ID = 3501;
$ hexdump -C test.gif
00000000 47 49 46 38 39 61 28 0a |GIF89a(.|
© Stack Overflow or respective owner