Merge 'DBIx-Class-current' into 'param_bind'
John Napiorkowski [Wed, 10 Jan 2007 21:08:36 +0000 (21:08 +0000)]
Merge from current and fixed issue when a column has multiple bind values.

lib/DBIx/Class/Storage/DBI.pm

index 27d4e66..26effd6 100644 (file)
@@ -856,19 +856,22 @@ sub _execute {
       foreach my $bound (@bind) {
 
         my $attributes = {};
-        my($column_name, $data) = @$bound;
+        my($column_name, @data) = @$bound;
 
         if( $bind_attributes ) {
           $attributes = $bind_attributes->{$column_name}
           if defined $bind_attributes->{$column_name};
-        }                      
+        }
 
-        $data = ref $data ? ''.$data : $data; # stringify args
+               foreach my $data (@data)
+               {
+          $data = ref $data ? ''.$data : $data; # stringify args
 
-        $sth->bind_param($placeholder_index, $data, $attributes);
-        $placeholder_index++;
+          $sth->bind_param($placeholder_index, $data, $attributes);
+          $placeholder_index++;                  
+               }
       }
-      $sth->execute;
+      $sth->execute();
     };
   
     if ($@ || !$rv) {
@@ -958,7 +961,6 @@ sub insert_bulk {
     foreach my $column ($source->columns) {
   
       my $data_type = $source->column_info($column)->{data_type} || '';
-         
       $bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
           if $data_type;
     }