[Dbix-class] unqouting ?

Ash Berlin ash at cpan.org
Thu Nov 2 18:19:50 GMT 2006


Ivan.Georgiev at uboc.com wrote:
> hmm.. to be correct the exact code I'm using is  :
> 
> my %record = ();
> .....
> $record{fieldX} = 'CURRENT_TIMESTAMP';
> $schema->ruleset('table')->create(\%record);
> 
> so :
> 
> my $timestamp = 'CURRENT_TIMESTAMP';
> $record{fieldX} = \$timestamp;
> 
> seems to work. 10x
> very weird !! isn't this wrong behaviour ?
> 
> 
> 
> 
> 
> |---------+---------------------------->
> |         |           Lee Standen      |
> |         |           <nom at standen.id.a|
> |         |           u>               |
> |         |                            |
> |         |           11/01/2006 07:44 |
> |         |           PM               |
> |         |           Please respond to|
> |         |           dbix-class       |
> |         |                            |
> |---------+---------------------------->
>   >--------------------------------------------------------------------------------------------------------------------|
>   |                                                                                                                    |
>   |       To:       dbix-class at lists.rawmode.org                                                                       |
>   |       cc:                                                                                                          |
>   |       Subject:  Re: [Dbix-class] unqouting ?                                                                       |
>   >--------------------------------------------------------------------------------------------------------------------|
> 
> 
> 
> 
> I believe that some (or more) methods don't do quoting if you use a
> scalar ref...
> 
> Tried fieldX => \'CURRENT_TIMESTAMP' ?
> 
> Ivan.Georgiev at uboc.com wrote:
>> hi,
>>
>> when I'm using $schema->ruleset('table')->create({ ..... fieldX =>
>> 'CURRENT_TIMESTAMP' ..});
>> The fieldX is set to "0000-00-00 00:00:00"  instead of current timestamp,
>> probably 'cause it
>> interpreters it like string instead of value. How can I tell dbix that it
>> should interpeter value literaly
>> instead quoting it ?
>>
>> thanx
>>
> 
> 
> 
Not in the slightest

How otherwise can DBIC tell whether you mean

   UPDATE table SET fieldX = CURRENT_TIMESTAP WHERE ....;

or

   UPDATE table SET fieldX = "CURRENT_TIMESTAMP" WHERE ....;





More information about the Dbix-class mailing list