my $ret = $self->next::method(@_);
- delete $self->{_column_data}{$_} for @dirty_columns;
+ delete $self->{_column_data}{$_} for @dirty_columns;
+ delete $self->{_inflated_column}{$_} for @dirty_columns;
return $ret;
}
next;
}
eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 27);
+ plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 30);
}
INIT {
}, undef, 23, $l->this);
is $l->oop, 23;
+
+ $l->delete;
+}
+
+
+# Now again for inflated values
+{
+ Lazy->has_a(
+ orp => 'Date::Simple',
+ inflate => sub { Date::Simple->new(shift . '-01-01') },
+ deflate => 'format'
+ );
+
+ my $l = Lazy->create({
+ this => 89,
+ that => 2,
+ orp => 1998,
+ });
+
+ $l->orp(2007);
+ is $l->orp, '2007-01-01'; # make sure it's inflated
+ $l->update;
+
+ ok $l->db_Main->do(qq{
+ UPDATE @{[ $l->table ]}
+ SET orp = ?
+ WHERE this = ?
+ }, undef, 1942, $l->this);
+
+ is $l->orp, '1942-01-01';
+
+ $l->delete;
}