-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/09/2015 10:31 AM, reddy ykk wrote: > I have a requirement of reading an image data (BLOB) from a > database. I could successfully read the length of the blob using > sqlite3_column_bytes() but when i try to read the entire blob > using sqlite3_column_blob(), i am getting undesired results.
You will need to give more detailed information, so we know what you are actually doing and what undesired results you are actually getting. http://catb.org/~esr/faqs/smart-questions.html > I am getting the bytes till NULL terminated string is present. In > my case, only 3 bytes of data are being returned by the method. That indicates a misunderstanding. You can only deal with blobs by having a pointer and a length. sqlite3_column_bytes() returns that length, and sqlite3_column_blob() returns a pointer where the length bytes are the data originally supplied. > Is there any way that if we specify the length, the whole blob data > is retrieved irrespective of the NULL bytes . sqlite3_column_bytes/blob do fundamentally work, and do inspection of the data since all bytes are valid in blobs. If they didn't a heck of a lot of people would have noticed by now. Repeatedly mentioning NULL is a strong indication that whatever non-SQLite routines you are using are the problem. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlT96gwACgkQmOOfHg372QQw+wCfU3la7vcCoezrsELJXmcQ7OjZ /Z8Ani3+roNc0s5d+jKQAm46xLw/i1Q7 =2RtC -----END PGP SIGNATURE-----