up by create() and populate()
- Ensure definitive condition extractor handles bizarre corner cases
without bombing out (RT#93244)
+ - Fix set_column on non-native (+columns) selections (RT#86685)
- Fix set_inflated_column incorrectly handling \[] literals (GH#44)
- Ensure that setting a column to a literal invariably marks it dirty
- Work around exception objects with broken string overloading in one
jon: Jon Schutz <jjschutz@cpan.org>
+Joe Carlson <jwcarlson@lbl.gov>
+
jshirley: J. Shirley <jshirley@gmail.com>
kaare: Kaare Rasmussen
}
sub _is_column_numeric {
- my ($self, $column) = @_;
+ my ($self, $column) = @_;
+
+ return undef unless $self->result_source->has_column($column);
+
my $colinfo = $self->result_source->column_info ($column);
# cache for speed (the object may *not* have a resultsource instance)
my $dirty =
$self->{_dirty_columns}{$column}
||
- $self->in_storage # no point tracking dirtyness on uninserted data
+ ( $self->in_storage # no point tracking dirtyness on uninserted data
? ! $self->_eq_column_values ($column, $old_value, $new_value)
: 1
+ )
;
if ($dirty) {
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+my $rs_with_avg = $schema->resultset('CD')->search({}, {
+ '+columns' => { avg_year => $schema->resultset('CD')->get_column('year')->func_rs('avg')->as_query },
+ order_by => 'cdid',
+});
+
+for my $in_storage (1, 0) {
+ my $cd = $rs_with_avg->first;
+
+ ok ! $cd->is_column_changed('avg_year'), 'no changes';
+
+ $cd->in_storage($in_storage);
+
+ ok ! $cd->is_column_changed('avg_year'), 'still no changes';
+
+ $cd->set_column( avg_year => 42 );
+ $cd->set_column( avg_year => 69 );
+
+ ok $cd->is_column_changed('avg_year'), 'changed';
+ is $cd->get_column('avg_year'), 69, 'correct value'
+}
+
+done_testing;