Making changes to the way the db class constructs sql queries