boutbagha / and-bookworm

Automatically exported from code.google.com/p/and-bookworm
0 stars 0 forks source link

BookUserData constraint issue #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Intermittent and strange bug after separating out DAOs, very seldom get a 
constraint error (I have seen it once).  After this happens the 
bookuserdata table has an extra record that does not exist in book table 
(seems like a rollback failure when using multiple tables). 

E/BookWorm( 8054): Error inserting book.
E/BookWorm( 8054): android.database.sqlite.SQLiteConstraintException: error 
code 19: constraint failed
E/BookWorm( 8054):  at 
android.database.sqlite.SQLiteStatement.native_execute(Native Method)
E/BookWorm( 8054):  at 
android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:
81)
E/BookWorm( 8054):  at 
com.totsp.bookworm.data.dao.BookUserDataDAO.insert(BookUserDataDAO.java:88)
E/BookWorm( 8054):  at 
com.totsp.bookworm.data.dao.BookDAO.insert(BookDAO.java:210)
E/BookWorm( 8054):  at 
com.totsp.bookworm.data.DataManager.insertBook(DataManager.java:86)
E/BookWorm( 8054):  at 
com.totsp.bookworm.BookEntryResult.bookAddClick(BookEntryResult.java:147)
E/BookWorm( 8054):  at 
com.totsp.bookworm.BookEntryResult.access$3(BookEntryResult.java:142)
E/BookWorm( 8054):  at 
com.totsp.bookworm.BookEntryResult$1.onClick(BookEntryResult.java:74)
E/BookWorm( 8054):  at android.view.View.performClick(View.java:2408)
E/BookWorm( 8054):  at 
android.view.View$PerformClick.run(View.java:8816)
E/BookWorm( 8054):  at 
android.os.Handler.handleCallback(Handler.java:587)
E/BookWorm( 8054):  at 
android.os.Handler.dispatchMessage(Handler.java:92)
E/BookWorm( 8054):  at android.os.Looper.loop(Looper.java:123)
E/BookWorm( 8054):  at 
android.app.ActivityThread.main(ActivityThread.java:4627)
E/BookWorm( 8054):  at java.lang.reflect.Method.invokeNative(Native 
Method)
E/BookWorm( 8054):  at java.lang.reflect.Method.invoke(Method.java:521)
E/BookWorm( 8054):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
868)
E/BookWorm( 8054):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/BookWorm( 8054):  at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by charlie....@gmail.com on 1 Jun 2010 at 12:27

GoogleCodeExporter commented 8 years ago
I added some code to try to fix this condition (by removing the record from 
bookuserdata), but I still don't know why it occurs to begin with. 

Original comment by charlie....@gmail.com on 1 Jun 2010 at 12:28

GoogleCodeExporter commented 8 years ago

Original comment by charlie....@gmail.com on 1 Jun 2010 at 12:33

GoogleCodeExporter commented 8 years ago
I added code in several places to try to prevent this, and then log if it 
occurs. 
Right now though, keeping it open as I know it exists but cannot reproduce it 
reliably. Open for more research/more info.

Original comment by charlie....@gmail.com on 1 Jun 2010 at 12:37

GoogleCodeExporter commented 8 years ago
Flipping orientation back and forth during and after search I was able to get 
this to 
happen again (still don't know exact steps, but saw it happen while testing). 
The new 
fix *DID WORK* and allowed the book to be added and cleaned up the table so 
other 
books could subsequently be added too. Still not sure how/why this occurs.

Original comment by charlie....@gmail.com on 1 Jun 2010 at 1:09

GoogleCodeExporter commented 8 years ago
Not seeing any more reports, closing.

Original comment by charlie....@gmail.com on 9 Jun 2010 at 11:08