Skip to content

Commit 90ef108

Browse files
committed
Pass a hashref of attributes that need special care as the last parameter to bulk_insert of the dbd
1 parent 709edda commit 90ef108

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • lib/Data/ObjectDriver/Driver

lib/Data/ObjectDriver/Driver/DBI.pm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,15 @@ sub bulk_insert {
644644
my $tbl = $driver->table_for($class);
645645
my @db_cols = map {$dbd->db_column_name($tbl, $_) } @{$cols};
646646

647-
return $dbd->bulk_insert($dbh, $tbl, \@db_cols, $data);
647+
my %attrs;
648+
my $col_defs = $class->properties->{column_defs};
649+
for my $col (@$cols) {
650+
my $type = $col_defs->{$col} || 'char';
651+
my $attr = $dbd->bind_param_attributes($type) or next;
652+
$attrs{$col} = $attr;
653+
}
654+
655+
return $dbd->bulk_insert($dbh, $tbl, \@db_cols, $data, \%attrs);
648656
}
649657

650658
sub begin_work {

0 commit comments

Comments
 (0)