in reply to The (Too-)Well Hidden Magic of "DBIx::Class"
Second, search() does INNER JOINS by default for has_one and belongs_to and LEFT JOINS by default for has_many.
The other piece you might be missing is everything is based on relationships. That's what join and prefetch are all about.
The final magic bit is the idea of the resultset. You can think of a resultset as a family of SQL statements (but it's a lot more than that). You can build resultsets from other resultsets and execute different SQL statements from the same resultset object. The X_related methods call X on the resultset found by the _related() relationship, but bound by the conditions set in the initial resultset. Oh - and you can build resultsets till the cows come home, but you don't actually touch the database until you get a row object.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
|
---|