robolectric/robolectric — pull request #800 by roman-mazur (2013-10-31 09:04:40+00:00)
Title: Redesign database related shadows

Some time ago I faced with some inconsistencies in shadows of cursors and started digging first removing shadow of matrix cursor and then...
This request is not a merge candidate right now but rather a proposal.

I'm playing with removing cursor shadows completely and shadowing only `SQLiteConnection` and `CursorWindow` instead ([ShadowSQLiteConnection](https://github.com/roman-mazur/robolectric/blob/cursor/src/main/java/org/robolectric/shadows/ShadowSQLiteConnection.java), [ShadowCursorWindow](https://github.com/roman-mazur/robolectric/blob/cursor/src/main/java/org/robolectric/shadows/ShadowCursorWindow.java)).

I've already made some progress in this direction and have some of database related tests passing. And now I'd like someone from the main team to take a look at the approach and start discussion. Perhaps it's not the way worth to be implemented.

Currently I have 2 main points that do not allow me to sleep sweetly:
* `SQLiteConnection` belongs to hidden API, and I'm not pretty sure what to do with old Android versions.
* Current JDBC driver cannot always satisfy needs of Android internal calls like [providing number of columns without making a real query](https://github.com/roman-mazur/robolectric/blob/cursor/src/main/java/org/robolectric/shadows/ShadowSQLiteConnection.java#L174) or [registering custom collators](https://github.com/roman-mazur/robolectric/blob/cursor/src/main/java/org/robolectric/shadows/ShadowSQLiteConnection.java#L240). So that to have everything implemented right we should switch to some Java wrapper for direct SQLite API.

So please take a look and tell what you think: should I go on or would I rather stop, delete this branch, and forget :).