Updated SQLite query helpers.