Showing 4 changed files with 18 additions and 2 deletions
+3
Changes
... ...
@@ -1,3 +1,6 @@
1
+0.1688
2
+    - fixed bug that model insert, update, delete select can't
3
+      odd number arguments
1 4
 0.1687
2 5
     - added EXPERIMENTAL type_rule method
3 6
     - added EXPERIMENTAL execute() type_rule_off option
+1 -1
lib/DBIx/Custom.pm
... ...
@@ -1,6 +1,6 @@
1 1
 package DBIx::Custom;
2 2
 
3
-our $VERSION = '0.1687';
3
+our $VERSION = '0.1688';
4 4
 
5 5
 use 5.008001;
6 6
 use strict;
+2 -1
lib/DBIx/Custom/Model.pm
... ...
@@ -52,13 +52,14 @@ foreach my $method (@methods) {
52 52
 
53 53
     my $code = sub {
54 54
         my $self = shift;
55
-        
55
+
56 56
         my @args = (
57 57
             table => $self->table,
58 58
             type => $self->type,
59 59
             primary_key => $self->primary_key
60 60
         );
61 61
         push @args, (join => $self->join) if $method =~ /^select/;
62
+        unshift @args, shift if @_ % 2;
62 63
         
63 64
         $self->dbi->$method(@args, @_);
64 65
     };
+12
t/dbix-custom-core-sqlite.t
... ...
@@ -2405,6 +2405,18 @@ is($row->{key1}, 1);
2405 2405
 is($row->{key2}, 2);
2406 2406
 is($row->{key3}, 3);
2407 2407
 
2408
+$dbi = MyDBI6->connect($NEW_ARGS->{0});
2409
+$dbi->execute($CREATE_TABLE->{1});
2410
+$dbi->model('table1')->insert(
2411
+    {key3 => 3},
2412
+    id => [1, 2]
2413
+);
2414
+$result = $dbi->model('table1')->select;
2415
+$row = $result->one;
2416
+is($row->{key1}, 1);
2417
+is($row->{key2}, 2);
2418
+is($row->{key3}, 3);
2419
+
2408 2420
 test 'update and id option';
2409 2421
 $dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2410 2422
 $dbi->execute($CREATE_TABLE->{1});