Does this mean, we must provide these triggers in ALL table setups? I
want all TIMESTAMP columns in all the tables in my database to be
inflated into My::DateTime objects. How to specify

such a behavior? My::DateTime is a subclass of  good old DateTime so I'm hoping 
this should

be doable with minimum of hassle?
 

thx 
  - Praveen  

----- Original Message ----
From: John Siracusa <[EMAIL PROTECTED]>
To: Rose-DB-Object <rose-db-object@lists.sourceforge.net>
Sent: Tuesday, January 23, 2007 11:30:26 PM
Subject: Re: [RDBO] Inflate Columns to User Defined Class

On 1/23/07 11:21 PM, Praveen Ray wrote:
> How would I make RDBO inflate a particular column to a user defined class?
> Instead of the built-in? For example, I'd like a BYTEA column to be inflated
> into my own class. I'm guessing somewhere in the $meta->setup call, I should
> be able to specify it but didn't find an example to do it.

You can, of course, write your own column class and map it to a particular
type name, but that's a bit of an undertaking.  If you just want to modify
an existing column class, use column triggers:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/Colum
n.pm#TRIGGERS

In this case, the inflate and deflate events are the ones you want.  And
yes, you can do this right in the column definition in your setup() call:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#ad
d_columns

"If the hash contains a key with the same name as a column trigger event
type (e.g., "on_set", "on_load", "inflate") then the value of that key must
be a code reference or a reference to an array of code references, which
will be added to the list of the column's triggers for the specified event
type."

-John



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to