Rely more on JDatabaseQuery class

I would like propose these changes to some queries. Feel free to accept or reject. I think this makes them a bit more clean and reliable but it's mostly personal aesthetic preference.