From: Arthur Axel "fREW" Schmidt Date: Thu, 11 Jun 2009 17:40:11 +0000 (+0000) Subject: Use new _resolve_column_sources method and begin insert_bulk method X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c79639079fceb6badbc10c1c5876c4b148532b01;p=dbsrgits%2FDBIx-Class-Historic.git Use new _resolve_column_sources method and begin insert_bulk method --- diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm index 75e9497..8fa8fe4 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -4,6 +4,11 @@ use warnings; use base qw/DBIx::Class::Storage::DBI::MSSQL/; +sub insert_bulk { + my ($self, $source, $cols, $data) = @_; + next::method(@_); +} + sub _prep_for_execute { my $self = shift; my ($op, $extra_bind, $ident, $args) = @_; @@ -11,19 +16,13 @@ sub _prep_for_execute { my ($sql, $bind) = $self->next::method (@_); $sql .= ';SELECT SCOPE_IDENTITY()' if $op eq 'insert'; - my $alias2src = $self->_resolve_ident_sources($ident); my %identity_insert_tables; - foreach my $bound (@{$bind}) { - my $col = $bound->[0]; - my $name_sep = $self->_sql_maker_opts->{name_sep} || '.'; + my $col_sources = $self->_resolve_column_sources($ident, [map $_->[0], @{$bind}]); - $col =~ s/^([^\Q${name_sep}\E]*)\Q${name_sep}\E//; - my $alias = $1 || 'me'; - my $rsrc = $alias2src->{$alias}; - - my $is_auto_increment = $rsrc && $rsrc->column_info($col)->{is_auto_increment}; - my $table; - if ($is_auto_increment) { + foreach my $bound (@{$bind}) { + my $col = $bound->[0]; + my $rsrc = $col_sources->{$col}; + if ($rsrc && $rsrc->column_info($col)->{is_auto_increment}) { $identity_insert_tables{$rsrc->from} = 1; } }