From: Arthur Axel "fREW" Schmidt Date: Fri, 22 Jan 2010 03:17:20 +0000 (+0000) Subject: add _is_numeric to ::Row X-Git-Tag: v0.08116~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0bb1a52f5e8c1d0e7f45f9f610e6e3bf78245dff;p=dbsrgits%2FDBIx-Class.git add _is_numeric to ::Row --- diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 60e4776..b0f24e8 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -776,6 +776,22 @@ sub get_inflated_columns { return ($self->get_columns, %inflated); } +sub _is_numeric { + my ($self, $column) = @_; + my $colinfo = $self->column_info ($column); + + # cache for speed (the object may *not* have a resultsource instance) + if (not defined $colinfo->{is_numeric} && $self->_source_handle) { + $colinfo->{is_numeric} = + $self->result_source->schema->storage->is_datatype_numeric ($colinfo->{data_type}) + ? 1 + : 0 + ; + } + + return $colinfo->{is_numeric}; +} + =head2 set_column $row->set_column($col => $val); @@ -820,18 +836,7 @@ sub set_column { $dirty = 0; } else { # do a numeric comparison if datatype allows it - my $colinfo = $self->column_info ($column); - - # cache for speed (the object may *not* have a resultsource instance) - if (not defined $colinfo->{is_numeric} && $self->_source_handle) { - $colinfo->{is_numeric} = - $self->result_source->schema->storage->is_datatype_numeric ($colinfo->{data_type}) - ? 1 - : 0 - ; - } - - if ($colinfo->{is_numeric}) { + if ($self->_is_numeric($column)) { $dirty = $old_value != $new_value; } else {