On 5/25/06, Guillermo Roditi <[EMAIL PROTECTED]> wrote:
I'd like to alter Rose::DB to be able to tabe a subref as a default value for a column in the table object classes so that upon insertion of a new row the default value can be dinamically calculated.
Yeah, I've been considering that feature. It's currently not possible but I may add it. That said...
Basically the promblem is that I want default for a column to be NOW().
You can do that already. Just specify 'NOW()' as the default value. start_date => { type => 'datetime', default => 'NOW()' } The only tricky bit is, if your DBD:: module for your database is not smart enough to bind a value like 'NOW()' correctly (e.g., DBD::mysql), you have to give RDBO permission to "inline" that value right in the SQL query instead of binding it to a placeholder. So, in you class that has this column, do this: __PACKAGE__->meta->allow_inline_column_values(1); Then it'll work the way you expect. -John ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object