[Bast-commits] r8400 - DBIx-Class/0.08/trunk/lib/DBIx/Class

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Fri Jan 22 03:17:21 GMT 2010


Author: frew
Date: 2010-01-22 03:17:20 +0000 (Fri, 22 Jan 2010)
New Revision: 8400

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
Log:
add _is_numeric to ::Row

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2010-01-21 22:39:52 UTC (rev 8399)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2010-01-22 03:17:20 UTC (rev 8400)
@@ -776,6 +776,22 @@
   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 @@
     $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 {




More information about the Bast-commits mailing list