我试图从一个SQLite数据库(Safari缓存:Cache.db)保存blob数据到一个文件,但由于某种原因,sqlite不会读取整个blob。我最终想用ruby做到这一点,但现在直接在sqlite命令提示符下工作的东西没问题。另外,我已经阅读了所有在stackoverflow中讨论这个的条目,但是其中大多数只讨论了将图像保存在blob中的性能,并且显示将blob保存到文件的条目在C#中没有帮助我。这里是我试过的:将Blob数据从SQLite数据库保存到文件
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 cfurl_cache_blob_data receiver_data where entry_ID = 3501;
的GIF89a(
原始(guest.gif)文件的hexdump都表明源码停止第一空值之后读取斑点:
$ hexdump都-C guest.gif 47 49 46 38 39 61 28 00 28 00 F7 00 00 F1 F5 FD |的GIF89a((....... |。
源码> .OUTPUT test.gif
源码>选择receiver_data从cfurl_cache_blob_data其中entry_ID = 3501;
$ hexdump -C test.gif
00000000 47 49 46 38 39 61 28 0a | GIF89a(。
是的,这工作:) 我本来想用红宝石保存垢文件,但我最终用java:http://stackoverflow.com/questions/2150265/retrieve-an-image-stored-as-blob-on-a-mysql-db 谢谢 – Felipe 2010-05-03 14:59:56