add option to open SQLite3 database read-only

from https://gist.github.com/ippeiukai/8034454