Apparently select count(*) on an empty sqlite_master table triggers bug #3774.
Used another query to check if there is data in that table which won't make
sqlite 3.6.12 crash.
debug ("Could not find schema version; checking for empty database...");
try {
int rows = -1;
- this.db.exec ("SELECT count(*) FROM sqlite_master",
+ this.db.exec ("SELECT count(type) FROM sqlite_master " +
+ "WHERE rowid=1",
null,
(stmt) => {
rows = stmt.column_int (0);