Android Question SQLite - BLOB field

artsoft

Active Member
Licensed User
Longtime User
Hi all!

I am currently working with big BLOBs in a SQLite DB.

(==> android:targetSdkVersion="30")

_________________________________________________________________________
I know that a SQLite DB can be very big:


2021-03-24 00_42_10-how big a SQLite DB can be - Google Suche - Brave.png



_________________________________________________________________________
And BLOB fields can have the following size:



2021-03-24 00_45_09-SQLite blob size - Google Suche - Brave.png




I can save big BLOBs (max. 5 MBytes) in my SQLite DB without any problems.


But the reading (selecting) of the BLOBs creates the following exception:

android.database.sqlite.SQLiteBlobTooBigException: Row too big to fit into CursorWindow requiredPos=0, totalRows=1



The cause of this exception is the big size of the BLOB in combination with the used CURSOR.

The size of the CURSOR is too small to get the Bytes() data from DB.

My question:
So, how I can increase the limit of the CURSOR in order to read my bytes arrays from DB without any exceptions?

Would be nice if somebody could help here :)

Thanks in advance and best regards
ARTsoft
 

artsoft

Active Member
Licensed User
Longtime User
If no zooming/panning is required, you could also resize the image. I don’t think there are any 4000x3000 phone screens. That’s how iOS does it with their iCloud picture management. The full size is stored on iCloud and a reduced size (appropriate for the phone’s screen) is stored on the phone.

Many thanks for this constructive help. I think - as I have already said - that it will be a combination of both: Image resolution and image quality.

Best regards
ARTsoft
 
Upvote 0

emexes

Expert
Licensed User
I'm really glad that you agree with me for once and support me - instead of making fun of me.
Have we met before? 🙃 I don't usually make fun of people, unless I'm in the firing line too.
I am very annoyed about the cursor limit.
Me too, and I hardly even use SQLite. What the heck are they thinking? You'd reckon they'd at least warn you on the way in that hey, best give your data a big hug because it might be the last you see of it. :rolleyes:
 
Upvote 0

artsoft

Active Member
Licensed User
Longtime User
Me too, and I hardly even use SQLite. What the heck are they thinking? You'd reckon they'd at least warn you on the way in that hey, best give your data a big hug because it might be the last you see of it. :rolleyes:

May I ask which DB is your favorite while developing apps for Android?
 
Upvote 0

emexes

Expert
Licensed User
May I ask which DB is your favorite while developing apps for Android?
I barely use database managers nowadays because I'm mostly just programming for myself ie no multiuser requirement, and my data fits easily within modern phone memory. I dabbled with SQLite a couple of years ago and it seemed ok, plus I understood it to be the default built-in Android database, so that'd make it my favorite.

On my regular PC, it's pretty much CSV everywhere. My most-used dataset is a bit over 5 million records and 250 MB. It changes once daily, and takes a few minutes to preprocess into a binary file which then loads from disk straight into memory in 4 seconds (or 0.3 seconds if it's already in the disk caching).
 
Upvote 0
Top