refactoring sqlite query strings; only minimal cleanup; no prepared statements could be made to work with model.setQuery