query class, database class