Ensure that a cursor outlives its database

Cursors now borrow a pointer to the database handle. This changes the prepare() api.
Merge pull request #62 from PeterReid/master

Ensure that a cursor outlives its database