(no commit message)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Row.pm
index 57f883f..6bf479c 100644 (file)
@@ -74,7 +74,15 @@ sub insert {
   my $source = $self->{result_source};
   $self->throw_exception("No result_source set on this object; can't insert")
     unless $source;
-  #use Data::Dumper; warn Dumper($self);
+
+  my $bind_attributes;
+  foreach my $column ($self->result_source->columns) {
+  
+    $bind_attributes->{$column} = $self->result_source->column_info($column)->{bind_attributes}
+     if defined $self->result_source->column_info($column)->{bind_attributes};
+  }
+  $self->result_source->storage->bind_attributes($bind_attributes);
+  
   $source->storage->insert($source->from, { $self->get_columns });
   $self->in_storage(1);
   $self->{_dirty_columns} = {};
@@ -116,6 +124,15 @@ sub update {
   my $ident_cond = $self->ident_condition;
   $self->throw_exception("Cannot safely update a row in a PK-less table")
     if ! keys %$ident_cond;
+
+  my $bind_attributes;
+  foreach my $column ($self->result_source->columns) {
+  
+    $bind_attributes->{$column} = $self->result_source->column_info($column)->{bind_attributes}
+     if defined $self->result_source->column_info($column)->{bind_attributes};
+  }
+  $self->result_source->storage->bind_attributes($bind_attributes);
+  
   my $rows = $self->result_source->storage->update(
                $self->result_source->from, \%to_update, $ident_cond);
   if ($rows == 0) {