[Dbix-class] oracle sysdate?

Charles Alderman charlie-lists at aldermania.com
Fri May 9 15:40:34 BST 2008


I know what you're saying as far as staying dbms independent, but I  
don't necessarily like doing it that way either.  My reasoning is that  
I don't always know if my application code will be running on the same  
machine as the database (or even that all application code will be  
running on the same machine), and I'd like to keep my timestamp  
columns consistent by always using the same clock.

Thanks,
Charles Alderman

----- Original Message -----
From: Hartmaier Alexander <Alexander.Hartmaier at t-systems.at>
Sent: Fri, 9 May 2008 16:19:22 +0200
Re: RE: [Dbix-class] oracle sysdate?



> I strongly suggest to declare your datetime columns as such and use   
> DateTime->now() to get the actual datetime and use that object for   
> your dbic calls!
> This way you are dbms independent.
>
> -Alex
>
>
> -----Original Message-----
> From: Charles Alderman [mailto:charlie-lists at aldermania.com]
> Sent: Friday, May 02, 2008 8:13 PM
> To: dbix-class at lists.scsys.co.uk
> Subject: Re: [Dbix-class] oracle sysdate?
>
> 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
>
>
>
>
> _______________________________________________
> 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
>
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
> Handelsgericht Wien, FN 79340b
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
> Notice: This e-mail contains information that is confidential and   
> may be privileged.
> If you are not the intended recipient, please notify the sender and   
> then delete this e-mail immediately.
> *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
>






More information about the DBIx-Class mailing list