Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^4: Why did DBIC overtake CDBI?

by siracusa (Friar)
on Sep 13, 2006 at 12:45 UTC ( #572730=note: print w/replies, xml ) Need Help??

in reply to Re^3: Why did DBIC overtake CDBI?
in thread Why did DBIC overtake CDBI?

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 :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://572730]
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2017-07-29 12:26 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (436 votes). Check out past polls.