ajlyon/zandy — Issue #58: Database connection safety
Author: ajlyon
Created: 2011-11-08 03:47:58+00:00
State: open

It looks like the current practice of giving DB objects to all the major classes, like Item, Attachment, etc, is a bad idea:
Crash report for 1.1.1: "was clicking thru subcollections rapidly, trying to sync them, suddenly zandy just crashed."

Stacktrace:
```
android.database.sqlite.SQLiteMisuseException: library routine called out of sequence: , while compiling: SELECT collection_name, collection_parent, etag, dirty, _id, collection_key, collection_size, timestamp FROM collections WHERE collection_parent=?
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
at android.database.sqlite.SQLiteCompiledSql.(SQLiteCompiledSql.java:65)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:83)
at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:49)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1309)
at com.gimranov.zandy.app.data.Database.query(Database.java:32)
at com.gimranov.zandy.app.data.ItemCollection.getSubcollections(ItemCollection.java:371)
at com.gimranov.zandy.app.data.CollectionAdapter.bindView(CollectionAdapter.java:66)
at android.widget.CursorAdapter.getView(CursorAdapter.java:186)
at android.widget.AbsListView.obtainView(AbsListView.java:1446)
at android.widget.ListView.makeAndAddView(ListView.java:1745)
at android.widget.ListView.fillSpecific(ListView.java:1290)
at android.widget.ListView.layoutChildren(ListView.java:1576)
at android.widget.AbsListView.onLayout(AbsListView.java:1273)
at android.view.View.layout(View.java:7192)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
at android.view.View.layout(View.java:7192)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7192)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
at android.view.View.layout(View.java:7192)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7192)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1145)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)
```