0

I got the following stack trace via ACRA. Galaxy Note II, Android 4.1.2:

android.database.sqlite.SQLiteException: integer overflow (code 1)
at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:968)
at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:133)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:196)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:244)
:
My app's methods

I've never seen this exception before -- anybody has any ideas what could be causing this?

Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
Tom anMoney
  • 1,231
  • 1
  • 14
  • 29
  • I only asks questions if, after an extensive research, I cannot come up with one on my own. This is the first time somebody actually gave me something useful. But thanks for your concern. – Tom anMoney Jan 22 '13 at 07:11

1 Answers1

1

It can occur in situations where you create a number that is larger than the size allowed for an integer. One way this could happen is if you are using an aggregation functions such as Sum. If you are summing too many things, you could end up with a number much too large that overflows the size of an integer.

More information can be found here: http://www.sqlite.org/lang_aggfunc.html

lbrendanl
  • 2,626
  • 4
  • 33
  • 54
  • Ok, thanks. It is a SUM aggregate query. I am summing user entered data. MAXINT appears to be 2^63-1, and I am allowing individual entries of 10^12-1. I am not sure how this user overflew this, but he must have. Anyway, cannot artificially restrict what they enter. That said, is there a way to avoid this crash? -- I assume really no. – Tom anMoney Jan 22 '13 at 07:25
  • Hmm not that I know of or could find through google. Only thing I could think of is to try catching the exception in your app code and displaying some sort of max number to the user or an error message, since they really shouldn't be inputing that much data, if I am understanding you right – lbrendanl Jan 22 '13 at 19:44