[eluser]gtech[/eluser]
I prefer the second option, I think its more through habit, as thats how I built my first AR queries and I haven't deviated from that.
In a few applications I have actually added another layer. I have a loggingsdb.php library which has the methods:- get,getwhere,insert,update,delete which then call the db functions. There are a few reasons I do this.
1. I can catch sql errors and return a meaningful error back to the calling function (a associative array gets returned containing error number and message)
2. I log all db calls and store them in the database
3. my delete method does not delete the data but marks rows for deletion
4. As I mark methods for deletion, in the insert functions I add a created date,version and a object-state flag. On the select functions I automatically add to the where clause the object-state's which are active.
*the get uses the db pointer so I can create flexible queries such as joins.