SQLite3 Support (v4.0.4 compatible)

This closes issue #99 .  It is based off of @axelaxel 's previous PR #398 (from Jan 2013)
The first commit is axelaxel's work, the second is changes needed to work with backup.

I can squash the two commits, if that is preferred.