[Bast-commits] r4800 -
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed Sep 10 22:11:25 BST 2008
Author: rafl
Date: 2008-09-10 22:11:25 +0100 (Wed, 10 Sep 2008)
New Revision: 4800
Modified:
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
Log:
Implement always_update.
Modified: DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-09-10 21:11:14 UTC (rev 4799)
+++ DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-09-10 21:11:25 UTC (rev 4800)
@@ -63,7 +63,7 @@
my $info = $self->column_info($column);
my $update_trigger = $info->{dynamic_default_on_update};
- push @update_columns, [$column => $update_trigger]
+ push @update_columns, [$column => $update_trigger, $info->{always_update} || 0]
if $update_trigger;
my $create_trigger = $info->{dynamic_default_on_create};
@@ -73,7 +73,7 @@
if (@update_columns || @create_columns) {
$self->__column_dynamic_default_triggers({
- on_update => \@update_columns,
+ on_update => [sort { $b->[2] <=> $a->[2] } @update_columns],
on_create => \@create_columns,
});
}
@@ -98,13 +98,15 @@
}
sub update {
- my $self = shift;
+ my ($self, $upd) = @_;
+ $self->set_inflated_columns($upd) if $upd;
my %dirty = $self->get_dirty_columns;
my @columns = @{ $self->__column_dynamic_default_triggers->{on_update} };
for my $column (@columns) {
my $column_name = $column->[0];
+ next if !%dirty && !$column->[2];
next if exists $dirty{$column_name};
my $meth = $column->[1];
More information about the Bast-commits
mailing list