[Dbix-class] Class::DBI => DBIx::Class.
Alan Humphrey
alan.humphrey at comcast.net
Sat Jan 21 17:11:19 CET 2006
I can comment on this from my on-going porting experience which has
generally been smooth.
-----
You get better performance, plus improved functionality including built
in paging, multi-column primary keys and grouping.
> I found the built in paging to be very helpful. If you've used Sweet it's
painless.
Porting code from CDBI is very straightforward for simple cases - all it
really involves is changing some syntax for your model classes and
possibly a few lines of template code. If your model classes are
generated by Loader, there may be even less to do ;)
> I tried going the Loader route for my Schema based app. No joy. I've had
to define each of my table classes by hand. Not a huge deal, but having
loader deal with the simple tables is something I miss. If you don't need
the Schema functionality this may not be an issue for you.
> Setting up relationships between tables takes some getting used to. This
is partly a problem with the docs (better, real world, examples would help)
and partly a terminology issue. For example, I was comfortable with the
'has_a' term. "This bird has a genus" worked for me. The new term is
"belongs_to". For whatever reason I didn't get comfortable with belongs_to
until I started thinking "The genus_id column belongs to the genera table."
> You may not have the same problem, but be aware that there are some
differences in terminology and you'll have to learn them. The docs, while
thin in places, are generally good. They'll get you most of the way
through.
> Key differences for my app code: the 'retrieve' method is now 'find' and
'get' is 'get_column'.
If you have a lot of set_sql statements, there is a bit more work but
afaik there hasn't been an SQL yet that couldn't be done in DBIC.
> This works two ways. On the one hand the statement is true - you can get
your SQL statements translated to DBIC. On the other hand, I find the
SQL::Abstract way of forming queries far from intuitive. Complex queries,
especially multi-table, are a struggle.
Triggers are not supported, as it is currently felt that they are not
necessary.
> Hasn't been an issue for me.
Discussion, feature requests, bugs, problems, etc please visit
#dbix-class at irc.perl.org.
> The folks on this list (especially Mr. Trout) are fantastic. Very
helpful, very nice. A great resource.
More information about the Dbix-class
mailing list