Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix messages database upgrade issues #983

Closed
daniele-athome opened this issue Apr 10, 2017 · 0 comments
Closed

Fix messages database upgrade issues #983

daniele-athome opened this issue Apr 10, 2017 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@daniele-athome
Copy link
Member

This is because the constants used for create table columns are shared among database versions queries. This is wrong: convert all static constants to full string contacts.

java.lang.RuntimeException: Unable to create application org.kontalk.Kontalk: android.database.sqlite.SQLiteException: table threads_new has 17 columns but 15 values were supplied (code 1): , while compiling: INSERT INTO threads_new SELECT _id, msg_id, SUBSTR(peer, 1, ?) || '@' || ?, direction, count, unread, 0, 'text/plain', content, timestamp, status_changed, status, 0, draft, 0 FROM threads
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4469)
       at android.app.ActivityThread.access$1500(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5139)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by android.database.sqlite.SQLiteException: table threads_new has 17 columns but 15 values were supplied (code 1): , while compiling: INSERT INTO threads_new SELECT _id, msg_id, SUBSTR(peer, 1, ?) || '@' || ?, direction, count, unread, 0, 'text/plain', content, timestamp, status_changed, status, 0, draft, 0 FROM threads
       at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
       at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
       at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
       at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
       at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
       at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1672)
       at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1653)
       at org.kontalk.provider.MessagesProvider$DatabaseHelper.onUpgrade(MessagesProvider.java:414)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:257)
       at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
       at org.kontalk.provider.MessagesProvider.query(MessagesProvider.java:575)
       at android.content.ContentProvider.query(ContentProvider.java:857)
       at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
       at android.content.ContentResolver.query(ContentResolver.java:461)
       at android.content.ContentResolver.query(ContentResolver.java:404)
       at org.kontalk.ui.MessagingNotification.updateMessagesNotification(MessagingNotification.java:224)
       at org.kontalk.Kontalk.onCreate(Kontalk.java:194)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4466)
       at android.app.ActivityThread.access$1500(ActivityThread.java:144)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5139)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
       at dalvik.system.NativeStart.main(NativeStart.java)
@daniele-athome daniele-athome added the bug Something isn't working label Apr 10, 2017
@daniele-athome daniele-athome added this to the 4.0.1 milestone Apr 10, 2017
@daniele-athome daniele-athome self-assigned this Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant