8

exactly i am trying to load more than 1MB of data from sqlite database to android cursor. At the time of loading it gives following error like

08-04 11:10:15.813: ERROR/CursorWindow(4465): need to grow: mSize = 2097152, size = 403719, freeSpace() = 209669, numRows = 1
08-04 11:10:15.813: ERROR/CursorWindow(4465): Attempting to grow window beyond max size (2097152)
08-04 11:10:15.813: ERROR/Cursor(4465): Failed allocating 403719 bytes for blob at 0,13
08-04 11:10:15.813: DEBUG/Cursor(4465): finish_program_and_get_row_count row 0
08-04 11:10:15.899: ERROR/CursorWindow(4465): need to grow: mSize = 2097152, size = 403719, freeSpace() = 209669, numRows = 1
08-04 11:10:15.899: ERROR/CursorWindow(4465): Attempting to grow window beyond max size (2097152)
08-04 11:10:15.899: ERROR/Cursor(4465): Failed allocating 403719 bytes for blob at 0,13
08-04 11:10:15.899: DEBUG/Cursor(4465): finish_program_and_get_row_count row 0
08-04 11:10:15.899: ERROR/CursorWindow(4465): Bad request for field slot 0,0. numRows = 0, numColumns = 14
08-04 11:10:15.899: DEBUG/AndroidRuntime(4465): Shutting down VM.

if any one knows how to load large data (more than 1MB) to android cursor? thanks,

ilango j
  • 5,967
  • 2
  • 28
  • 25
  • Why do you have 1MB worth of data in a cursor? Tons of rows? Are you using a projection to only use the columns you need? Do you use blobs? Can you limit the results? – EboMike Aug 04 '11 at 08:43
  • i have two blob objects in a table one is for image and other one is for audio. The two blob's size is more than 1MB. One single row size is more than 1mb. then how can i do? – ilango j Aug 04 '11 at 08:53

1 Answers1

8

Don't store blobs of 500KB in your database. Store identifiers in your database and put the blobs as files onto the storage. If you use MODE_PRIVATE, they will not be accessible by other processes.

EboMike
  • 76,846
  • 14
  • 164
  • 167
  • 1
    ok thanks for your suggestion. but i want to use database for some reason's. – ilango j Aug 05 '11 at 04:21
  • 2
    ...which are? You're using a mobile platform, so you need a good reason to prefer an inefficient storage method. – EboMike Aug 05 '11 at 04:37
  • how to create a mode private folders in application directory? – ilango j Aug 05 '11 at 05:26
  • Like I said, use MODE_PRIVATE. See here: Context.openFileOutput: http://developer.android.com/reference/android/content/Context.html#openFileOutput%28java.lang.String,%20int%29 – EboMike Aug 05 '11 at 06:03