Sunday, December 19, 2010

ORM -- database abstractions

I've just learned of DBIx::Class::CDBICompat, a Class::DBI compatibility layer for DBIx::Class. Awesome.


DBIx::Class features a fully featured compatibility layer with Class::DBI and some common plugins to ease transition for existing CDBI users.

This is not a wrapper or subclass of DBIx::Class but rather a series of plugins. The result being that even though you're using the Class::DBI emulation layer you are still getting DBIx::Class objects. You can use all DBIx::Class features and methods via CDBICompat. This allows you to take advantage of DBIx::Class features without having to rewrite your CDBI code.

I have inherited an app based on Class::DBI, but I'm not terribly familiar with Class::DBI. So far, the SQL snippet approach is annoying. There are lurking bugs (in our code, not Class::DBI), but mocking and fixing with CDBI is proving to be a pain. It's good to know that if I rewrite all the DB layer in DBIxClass over the holidays, that I'll be able to shim some of the old code onto it through a compatibility layer.

Related topics:

DBIx::Class vs Class::DBI vs Rose::DB::Object vs Fey::ORM by fRew
PerlMonks discussion
Class:DBI vs DBIx::Class vs Rose::DB::Object
"DBIxDM is very interesting and Laurent Dami helps the DBIC team maintain SQL::Abstract – but he also doesn’t manage to market it to save his life so very few people have heard of it." -- Matt Trout
Rose::DB -- hand coded to be fastest of the 4?
Marlon suggested looking more deeply into the DB benchmarks.
"You really should run the benchmarks of Rose::DB vs DBIC. Your database layer is usually your slowest in your entire application, so that’s important. RDBO is also the ORM we use at because speed is important at this level. I’ll be interested in looking at what the new revision of DBIC with Moose does in that arena. On a side note, I agree that the generative queries are excellent on DBIC."


2006 discussion of Rose vs DBIx, by the Rose Author.

No comments: