[Bast-commits] r7461 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class/Storage t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Tue Sep 1 14:51:59 GMT 2009


Author: ribasushi
Date: 2009-09-01 14:51:58 +0000 (Tue, 01 Sep 2009)
New Revision: 7461

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/trunk/t/746mssql.t
Log:
Fix insert_bulk with rebless

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2009-09-01 11:34:59 UTC (rev 7460)
+++ DBIx-Class/0.08/trunk/Changes	2009-09-01 14:51:58 UTC (rev 7461)
@@ -4,6 +4,7 @@
           coderef, allowing better intergration with Catalyst
         - Fixed a complex prefetch + regular join regression introduced
           in 0.08108
+        - Fixed insert_bulk rebless handling
         - SQLT related fixes:
           - sqlt_type is now called on the correct storage object
           - hooks can now see the correct producer_type

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-09-01 11:34:59 UTC (rev 7460)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm	2009-09-01 14:51:58 UTC (rev 7461)
@@ -1303,13 +1303,18 @@
 ## only prepped once.
 sub insert_bulk {
   my ($self, $source, $cols, $data) = @_;
+
+# redispatch to insert_bulk method of storage we reblessed into, if necessary
+  if (not $self->_driver_determined) {
+    $self->_determine_driver;
+    goto $self->can('insert_bulk');
+  }
+
   my %colvalues;
   my $table = $source->from;
   @colvalues{@$cols} = (0..$#$cols);
   my ($sql, @bind) = $self->sql_maker->insert($table, \%colvalues);
 
-  $self->_determine_driver;
-
   $self->_query_start( $sql, @bind );
   my $sth = $self->sth($sql);
 

Modified: DBIx-Class/0.08/trunk/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/trunk/t/746mssql.t	2009-09-01 11:34:59 UTC (rev 7460)
+++ DBIx-Class/0.08/trunk/t/746mssql.t	2009-09-01 14:51:58 UTC (rev 7461)
@@ -198,6 +198,7 @@
 });
 
 lives_ok ( sub {
+  my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
   $schema->populate ('Owners', [
     [qw/id  name  /],
     [qw/1   wiggle/],
@@ -219,6 +220,7 @@
 }, 'populate with PKs supplied ok' );
 
 lives_ok ( sub {
+  my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
   $schema->populate ('BooksInLibrary', [
     [qw/source  owner title   /],
     [qw/Library 1     secrets0/],




More information about the Bast-commits mailing list