add option to open SQLite3 database read-only

(from https://gist.github.com/ippeiukai/8034454)

This is useful for accessing external data that one would not want to accidentally modify.