简体   繁体   中英

Select rows in onUpgrade method

I have created method to select rows using getReadableDatabase() and cursors, everything is working fine, but when I try to use that method in onUpgrade, my app is crashing.

Did someone had similar problem?

onUpgrade() is triggered by an attempt to open a database via the SQLiteOpenHelper. getReadableDatabase() uses the SQLiteOpenHelper, so calling your method from onUpgrade will cause endless recursion, and a stack overflow.

So, you'll need a version of your method that uses the database passed into the onUpgrade() method instead of calling getReadableDatabase()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM