Adding a get last query method to the database class.