[Dbix-class] Bind order bug, patch/test for review

Marc Mims marc at questright.com
Fri Sep 28 00:45:23 GMT 2007


The other day I ran into a bind order bug.  Getting a test and patch
together was hampered by what appears to be a DBD::SQLite bug---but
that's another story.

The patch is simple enough:

=== lib/DBIx/Class/Storage/DBI.pm
==================================================================
--- lib/DBIx/Class/Storage/DBI.pm       (revision 1335)
+++ lib/DBIx/Class/Storage/DBI.pm       (local)
@@ -913,7 +913,7 @@
   my ($self, $op, $extra_bind, $ident, $args) = @_;
 
   my ($sql, @bind) = $self->sql_maker->$op($ident, @$args);
-  unshift(@bind,
+  push(@bind,
     map { ref $_ eq 'ARRAY' ? $_ : [ '!!dummy', $_ ] } @$extra_bind)
       if $extra_bind;


The attached test fails without the patch, succeeds with it, and all
other tests in 0.08/trunk pass with it.

Can it be this simple?  Surely there was some reason for unshift instead
of push, but I didn't discover it.

There may be a much better way to test this than the attached
test---suggestions?  I'll also need a name for the test before I commit.

	-Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjm-bind.t
Type: application/x-troff
Size: 457 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20070927/62e270a7/mjm-bind.t


More information about the DBIx-Class mailing list