caarmen / poet-assistant

Android app with rhyming dictionary, thesaurus, and dictionary, with text-to-speech functionality to read your poem.
Other
83 stars 11 forks source link

Crash when searching for "henchmen" #35

Closed caarmen closed 7 years ago

caarmen commented 7 years ago

Steps to reproduce:

Reason: there is a huge number (12000+) of words matching "henchmen", and we try to do a single query trying to find out which ones have definitions or not. Solution: split this single query into smaller queries and aggregate the results.

java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:161)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
Caused by: android.database.sqlite.SQLiteException: too many SQL variables (code 1): , while compiling: SELECT word FROM word_variants WHERE word in (?,?,...?,?,?,?) AND has_definition=1
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1093)
    at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:670)
    at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1440)
    at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1287)
    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1158)
    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1326)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.Rhymer.getWordsWithDefinitions(Rhymer.java:137)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.RhymerLoader.addResultSection(RhymerLoader.java:129)
    at ca.rmen.android.poetassistant.main.dictionaries.rt.RhymerLoader.loadInBackground(RhymerLoader.java:2087)```