0

I'm inserting images in a table in SQLLite. I created the table which has a Blob Field and it's inserting great (at least I get the Id of the inserted record).

The problem is when I try to select the Blob field to use it anywhere else.

For example: SELECT Field1, ImageBlob FROM Images returns and empty set. However SELECT Field1 FROM Images returns all the records. Also Select * From Images returns an empty set

I can use the field in a where clause. For example, if my query is a count() where ImageBlob IS NULL I get a zero. But when my query is a Count() where ImageaBlob IS NOT NULL, I got the number of records of the table.

Any suggestions with this?

LuisEduardoSP
  • 401
  • 5
  • 11

1 Answers1

1

There are size limits related to Android's SQLite implementation. BLOBs that exceed the limit can't be retrieved by the client. You might see messages in the Android debug log (or exceptions).

Perhaps store the images as files?

You could also read the BLOB in multiple chunks using substr instead as per this answer Android sqlite how to retrieve blob > 1 mb in chunks correctly

SQLite suggests it's more efficient to store values over 100 KB in size on disk: https://www.sqlite.org/intern-v-extern-blob.html

jspcal
  • 50,847
  • 7
  • 72
  • 76