Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why did DBIC overtake CDBI?

by rinceWind (Monsignor)
on Sep 12, 2006 at 16:33 UTC ( #572569=note: print w/ replies, xml ) Need Help??


in reply to Why did DBIC overtake CDBI?

There were some talks given at YAPC::EU on this subject and related matters. I point you to davorg's slides What's wrong with ORM, which I think should really have been titled "What's wrong with Class::DBI" as DBIC has fixed many of these issues.

In another talk, Matt Trout explained the positive vibes in the community which have made DBIC a success, and exceeded his initial ambitions.

I'm using CDBI for some database application stuff (not web stuff). Although it's slower than raw DBI SQL, this is to be expected. The main problem I have is that I had to modify CDBI to get it to work with Sybase mixed case columns; I submitted a patch to Tony Bowden, but this patch has not been accepted. I'm currently reviewing DBIC with a view to migrating.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)


Comment on Re: Why did DBIC overtake CDBI?
Re^2: Why did DBIC overtake CDBI?
by perrin (Chancellor) on Sep 12, 2006 at 17:04 UTC
    No offense to davorg, but that talk was obsolete years ago. Class::DBI has plenty of auto-discovery tools. There's no reason you'd have to hard-code those things if you don't want to.

      I know that Class::DBI::Loader will automatically load tables, columns and relationships. But does it, for example, automatically turn DATETIME columns into DateTime objects[1]? Or use column types to determine valid values for attributes?

      The talk is a bit badly organised. The examples are all in Class::DBI (as that's what I was using when I originally wrote the talk) but the lists of items that an ORM should handle shouldn't be taken as a list of things that Class::DBI doesn't do. If anything the talk is a reaction to the number of obvious things that ActiveRecord doesn't do.

      As I said in the presentation at YAPC, the talk is misnamed. Even when I first wrote it, it should have been called "What's Wrong With Some Current ORM Implementations". These days, it should really be called something like "Things To Look For When Choosing An ORM".

      [1] The key word here being "automatically". I know you can use the inflate/deflate functionality, but as far as I know you need to set that up explicitly.

      --
      <http://dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        It does some of that, but not all. For example, Class::DBI::mysql lets you do this:
        __PACKAGE__->autoinflate(dates => 'Time::Piece');
        It can also retrieve the accepted list of values for an ENUM column. Tim Bunce posted some code that went further to add automatic value checking based on column type, but it was never formally released as a module.

        These days I would advise people to use one of the newer ORMs instead, but Class::DBI's weaknesses are mostly in the SQL generation area, not in auto-discovery.

        I know that Class::DBI::Loader will automatically load tables, columns and relationships. But does it, for example, automatically turn DATETIME columns into DateTime objects[1]? Or use column types to determine valid values for attributes? [...]

        [1] The key word here being "automatically". I know you can use the inflate/deflate functionality, but as far as I know you need to set that up explicitly.

        FWIW, Rose::DB::Object will do this for you—and not just for DATETIME columns. It'll also turn BIT columns into Bit::Vector objects, TIME (or DATETIME HOUR TO (MINUTE|SECOND)) columns into Time::Clock objects, Postgres arrays (e.g., INT[]) into Perl arrays, BOOLEAN columns into 1 or 0 (regardless of whether the db uses "f", "false", "F", or whatever), BIGINT columns into Math::BigInt objects, and so on. (It'll also detect ENUM fields and constrain them to the valid set of values, validate dates and times, etc.)

        As I said in the presentation at YAPC, the talk is misnamed. Even when I first wrote it, it should have been called "What's Wrong With Some Current ORM Implementations". These days, it should really be called something like "Things To Look For When Choosing An ORM".

        Indeed :)

Re^2: Why did DBIC overtake CDBI?
by mattr (Curate) on Sep 13, 2006 at 13:46 UTC
    Great, thanks for pointing me to the slides.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://572569]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-09-01 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (17 votes), past polls