Menu

#133 cppDb with sqlite3: blob data inserted as text instead of blob

cppcms-1.2
open
nobody
None
1
2014-10-30
2014-08-20
Anonymous
No

When trying to insert blob data in sqlite3 throw cppDb, data is actually stored as text rather than blob. Changing the following code in sqlite3_backend.cpp seems to fix the issue, but I am not sure if there are side effects to this:

virtual void bind(int col,std::istream &v)
{
...
check_bind(sqlite3_bind_text(st_,col,tmp.c_str(),tmp.size(),SQLITE_TRANSIENT));
}

replaced with
check_bind(sqlite3_bind_blob(st_,col,tmp.c_str(),tmp.size(),SQLITE_TRANSIENT));

Discussion

Anonymous
Anonymous

Add attachments
Cancel