This is quite puzzling!

$item->as_of( "2001-12-31 23:59:59" );
$params->{as_of} = "2005-05-05 05:05:05";
$form->process( item => $item, params => $params );
# here, $item->as_of is CURRENT_TIMESTAMP regardless!

We're wanting to keep the timestamp as-is, not
set-to-current-timestamp-upon-every-update.

Using HTML::FormHandler (v0.32005) to process the $form, it doesn't seem to
matter what we stuff into the $params->{as_of} field, or what we inject into
the $item->as_of() field itself, it gets set to current timestamp no matter
what. All suggestions and clue-sticks welcome.

In MyApp::Schema::DB::Result::MyTable we override the db field completely:

__PACKAGE__->add_columns('as_of',
    {
#       %{__PACKAGE__->column_info('as_of')},
    data_type => 'timestamp',
    datetime_undef_if_invalid => 1,
#   default_value => \"current_timestamp",
    is_nullable => 0,
#       set_on_create => 1,
#       *set_on_update => 0*, # ignored wholesale from what we can tell
    } );

So there's no "set_on_create" or "set_on_update" at all:

  DB<10> x $item->column_info('as_of')
0  HASH(0xd7d2538)
   '_ic_dt_method' => 'timestamp'
   '_inflate_info' => HASH(0xd7d8fd0)
      'deflate' => CODE(0xd7d90d0)
         ->
&DBIx::Class::InflateColumn::DateTime::__ANON__[/usr/local/share/perl/5.10.0/DBIx/Class/InflateColumn/DateTime.pm:190]
in /usr/local/share/perl/5.10.0/DBIx/Class/InflateColumn/DateTime.pm:185-190
      'inflate' => CODE(0xd7d1e68)
         ->
&DBIx::Class::InflateColumn::DateTime::__ANON__[/usr/local/share/perl/5.10.0/DBIx/Class/InflateColumn/DateTime.pm:184]
in /usr/local/share/perl/5.10.0/DBIx/Class/InflateColumn/DateTime.pm:169-184
   'data_type' => 'timestamp'
   'datetime_undef_if_invalid' => 1
   'is_nullable' => 0
   'name' => 'as_of'

"Jane! How do I stop this crazy thing?!" Pointers welcome.


On Tue, Jul 19, 2011 at 3:53 PM, will trillich
<will.trill...@serensoft.com>wrote:

> Been using DBIx::Class (v0.08127) for a while now with Catalyst (v5.80032)
> and Moose (v1.24), what a great suite of powerful libraries!
>
> Question on how to turn OFF or DISABLE *set_on_update* tho:
>
> __PACKAGE__->add_columns('as_of',
>     {
>         %{__PACKAGE__->column_info('as_of')},
>         set_on_create => 1,
> #       set_on_update => 0,
>     } );
>
> The set_on_create is working as expected. The set_on_update seems to work
> whether we specify 1 or 0 or leave the declaration out altogether.
>
> Is there another setting somewhere that interferes?
>
>
> --
> "Don't just accept the benefits of civilization -- add to it. Extend it.
> Preserve it." -- Jeff Greason
>



-- 
"Don't just accept the benefits of civilization -- add to it. Extend it.
Preserve it." -- Jeff Greason
_______________________________________________
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.scsys.co.uk

Reply via email to