This I think? http://stackoverflow.com/a/3496275   You'd need to do it only if db == ":memory:" or something.