[Dbix-class] oracle sysdate?

Charles Alderman charlie-lists at aldermania.com
Fri May 2 19:13:27 BST 2008


Jennifer,

I have not ever used oracle sysdate with DBIx::Class, but I just  
figured out how to use mysql's now(), which was not immediately  
obvious to me.

I don't know if you're having the same issue, but I'll describe what  
happened to me.

I have a timestamp column called 'last_updated', and I want to update  
it to the current time.

<code>

$row = $schema->resultset(...)->find(...);

# This doesn't work because it treats the 'NOW()' string as a binded variable.
# it crashes because its pushing the literal 'NOW()' into the timestamp column

$row->last_updated('NOW()');
$row->update;

# This does work because when passing in a ref to the scalar,
# bind vars aren't used.

$row->update( { last_updated => \'NOW()' } );

</code>

Maybe the same thing applies to what you're doing with SYSDATE?

Thanks,
Charles Alderman


----- Original Message -----
From: Jennifer Ahn <jenahn at stanford.edu>
Sent: Wed, 30 Apr 2008 09:42:25 -0700
Re: [Dbix-class] oracle sysdate?



> hello!
>
> has anybody successfully used the oracle sysdate using dbix:class?
>
> thanks!
>
> jennifer
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:   
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org






More information about the DBIx-Class mailing list