On 6/14/06, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > is there a trivial way to get the time in rose -- from the database > that you are connected to? > > i really just need a wrapper for "SELECT NOW()" - i haven't seen it > in the docs, but rose seems to have everything in there, so i > figure if i can think of something, its already been done.
That's kind of an odd thing to want :) Can't you get your local time and adjust it to the time zone of the db, if necessary? Anyway, if you want something like this, I suggest adding it to your Rose::DB subclass. Maybe something like this: package My::DB; use base 'Rose::DB'; ... sub current_datetime { my($self) = shift; my $sth = $self->dbh->prepare('SELECT NOW()'); # from clause needed? $sth->execute; my $now = $sth->fetchrow_array; # Return a DateTime object return $self->parse_datetime($now); } ...plus or minus some error checking, yada yada. So no, not built in, but not hard to do either, and you can take advantage of Rose::DB's vendor-specific datetime parsing methods to inflate the string returned by NOW() into something more useful. -John _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object