|
Re: select time: msg#00050lang.perl.modules.dbi.rose-db-object
On 6/14/06, Jonathan Vanasco <rosedb-GYD5gbT+W3w@xxxxxxxxxxxxxxxx> 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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | select time, Jonathan Vanasco |
|---|---|
| Next by Date: | Re: select time, Jonathan Vanasco |
| Previous by Thread: | select time, Jonathan Vanasco |
| Next by Thread: | Re: select time, Jonathan Vanasco |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |