From: Rafael Kitover <rkitover@cpan.org>
Date: Fri, 12 Feb 2010 19:43:20 +0000 (+0000)
Subject: special bind_param_array move to make DBD::InterBase happy (RT#54561)
X-Git-Tag: v0.08121~73^2~26
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17d59d97920c4698228ef4e21bfd76214f7a33d5;p=dbsrgits%2FDBIx-Class.git

special bind_param_array move to make DBD::InterBase happy (RT#54561)
---

diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index 32c6ed1..055d2dc 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -1518,7 +1518,11 @@ sub _execute_array {
 
     my @data = map { $_->[$data_index] } @$data;
 
-    $sth->bind_param_array( $placeholder_index, [@data], $attributes );
+    $sth->bind_param_array(
+      $placeholder_index,
+      [@data],
+      (%$attributes ?  $attributes : ()),
+    );
     $placeholder_index++;
   }
 
diff --git a/t/750firebird.t b/t/750firebird.t
index a1f9807..55ed075 100644
--- a/t/750firebird.t
+++ b/t/750firebird.t
@@ -116,18 +116,17 @@ EOF
     for (1..2) {
       push @pop, { name => "Artist_expkey_$_", artistid => 100 + $_ };
     }
-    # XXX why does insert_bulk not work here?
-    my @foo = $ars->populate (\@pop);
+    $ars->populate (\@pop);
   });
 
 # count what we did so far
   is ($ars->count, 6, 'Simple count works');
 
 # test UPDATE
-  lives_ok {
-    $schema->resultset('Artist')
-           ->search({name => 'foo'})
-           ->update({rank => 4 });
+  lives_and {
+    $ars->search({ name => 'foo' })->update({ rank => 4 });
+
+    is $ars->search({ name => 'foo' })->first->rank, 4;
   } 'Can update a column';
 
   my ($updated) = $schema->resultset('Artist')->search({name => 'foo'});
@@ -151,6 +150,15 @@ EOF
   is( $lim->next->artistid, 102, "iterator->next ok" );
   is( $lim->next, undef, "next past end of resultset ok" );
 
+# test multiple executing cursors
+  {
+    my $rs1 = $ars->search({}, { order_by => { -asc  => 'artistid' }});
+    my $rs2 = $ars->search({}, { order_by => { -desc => 'artistid' }});
+
+    is $rs1->first->artistid, 1,   'multiple cursors';
+    is $rs2->first->artistid, 102, 'multiple cursors';
+  }
+
 # test empty insert
   {
     local $ars->result_source->column_info('artistid')->{is_auto_increment} = 0;