Ensure that a cursor outlives its database

Cursors now borrow a pointer to the database handle. This changes the prepare() api.

If you turn on debug logging before applying this commit, you can see the database's Drop running before the cursor's.

I'm no rust expert, so this may not be the best way.