[Dbix-class] Datetime format for MySQL and SQLite
Fayland Lam
fayland at gmail.com
Sun Jan 20 12:10:46 GMT 2008
well, in product server I'm using MySQL and for test cases I'm using SQLite.
so I wonder to ask whether there is any suggestion for something like
follows:
I have a Foorum::ResultSet::Comment, and in one sub I write
my $comment = $self->create(
{ object_type => $object_type,
object_id => $object_id,
author_id => $user_id,
title => $title,
text => $text,
formatter => $formatter,
post_on => \'NOW()', #' SQLite use
CURRENT_TIMESTAMP
post_ip => $post_ip,
reply_to => $reply_to,
forum_id => $forum_id,
upload_id => $info->{upload_id} || 0,
}
);
u know SQLite need use \'CURRENT_TIMESTAMP' instead of \'NOW()'. it will
fail when I call prove -l to test this sub.
How do I know $self->schema or result_source is based on SQLite or MySQL?
Any suggestion to deal with this situation?
Thanks.
--
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/
More information about the DBIx-Class
mailing list