Jared Miller wrote: > > //bind blob m_pSqliteDB->BindBlob(blobHandle, 1, (void *)bmBytes, > bmSize); //calls sqlite3_bind_blob (bmBytes is the pData param) >
Can you show the code you use to call sqlite3_bind_blob() as well? > Then I call StepQuery to execute it, and then I close the query. > sqlite3_bind_blob() returns SQLITE_OK when I run it, so it does not > seem to be encountering an error there. > > Something apparently gets written to the database, but it does not > seem to be correct. When I try to retrieve and display my image, it > is all black (which is how bitmaps look when there is no data). > > I think that the problem is coming from writing the BLOB to the > database, but I am not entirely sure. Just in case it is getting > written properly and I am not reading it from the database correctly, > I will show you how I pulled it from the DB. > > //prepare blob sqlite3_blob* pBlob = NULL; > sqlite3_blob_open(m_sqliteDB, "main", "tblBlob", "Data", iBlobID, > FALSE, &pBlob); > > BLOB_HANDLE hBlob = pBlob; int size = sqlite3_blob_bytes(hBlob); > //works correctly, returns 998058 BYTE* pBuffer = > g_MemMgr.AllocDataBuffer(size); > > sqlite3_blob_read(hBlob, pBuffer, size, 0); //returns SQLITE_OK > sqlite3_blob_close(hBlob); > > I then try to make a bitmap out of the bytes in pBuffer, but when I > do, it turns out all black (as I mentioned earlier). > Instead of making a bitmap, can you call memcmp() to compare the data in the two buffers at pBuffer and bmBytes? That would allow a direct comparison of the data that was written and the data that was read back. > Do I have the concept correct? I think so. HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users