On 8/14/07, George Hartzell <[EMAIL PROTECTED]> wrote:
> The default value of "now" does work when used in the RDBO perl
> module.  The problem is that since I'm using RDBO::Loader, the only
> way to get that value in there is to use it in the SQL, where it
> doesn't do what is intended.

Remember that the Loader also provides hooks to modify the metadata
pulled from the database, both before and after class initialization.
In this case, you could add a pre_init_hook that walks over all the
columns and replaces any default "current_datetime" values on datetime
columns with "now".

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Loader.pm#pre_init_hook

> Can you give me a hint on setting up the inlining?  It looks like I'll
> need to change
> Rose::DB::Object::Metadata::Column::Timestamp::should_inline_value so
> that it checks (off the top of my head)
>
>   ($_[1]->driver eq 'sqlite' && $_[2] =~ /current_datetime/i)
>
> or something close to that.  I'll have to figure out how to work it
> into the existing ternary test.

You shouldn't need to modify should_inline_value().  Instead, add
"current_datetime" as a valid "keyword" for SQLite date/time columns.
To do this, alter the validate_*_keyword() method(s) in
Rose::DB::SQLite.  This fix will be in the next release, but I haven't
don't it yet.  If you do it first, feel free to post a patch :)

-John

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to