[Bast-commits] r6631 - DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Thu Jun 11 17:40:11 GMT 2009


Author: frew
Date: 2009-06-11 17:40:11 +0000 (Thu, 11 Jun 2009)
New Revision: 6631

Modified:
   DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
Log:
Use new _resolve_column_sources method and begin insert_bulk method

Modified: DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-06-11 17:39:00 UTC (rev 6630)
+++ DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-06-11 17:40:11 UTC (rev 6631)
@@ -4,6 +4,11 @@
 
 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 @@
   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;
     }
   }




More information about the Bast-commits mailing list