in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Retrieving BLOB data from an old sqlite database

Last post 06-16-2010 8:31 AM by skyjt. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-05-2010 10:42 AM

    • skyjt
    • Not Ranked
    • Joined on 06-05-2010
    • Posts 2

    Retrieving BLOB data from an old sqlite database

    Hi!

    I had been using a C++ wrapper for SQLite to store image data as BLOBs in a table. Before the data is stored, it was encoded using the old sqlite_encode_binary function (which I think is no longer available). So my problem is that after porting the code to C#, the data which used to be stored in the database can no longer to retrieved with System.Data.SQLite without some transformation.

    I managed to find the source code for the sqlite_decode_binary function and managed to transform the data back into JPEG data with some success, but the images are still corrupted (will display but has corrupted lines, some more so than others). I suspect that when the file is read as a BLOB, there is some level of decoding done (perhaps to properly encode certain characters?) before it is read back out. However, I can't seem to figure out what this decoding is. Would anyone be able to help?

    Thanks!
    Jerome

  • 06-16-2010 8:31 AM In reply to

    • skyjt
    • Not Ranked
    • Joined on 06-05-2010
    • Posts 2

    Re: Retrieving BLOB data from an old sqlite database

    Answer
    Haha. Found the answer myself. The thing that stumped me was that the source code for the decode_binary function was not the same one used in the C++ wrapper which I was using. (Although the functions are quite similiar in rotating the byte values...) If anyone else encounters the same problem as me, (using Rob Grove's great C++ wrapper for SQLite), base your data transformation on the decode_binary function found in his source files instead. Jerome
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems