Showing 3 changed files with 64 additions and 62 deletions
+2
Changes
... ...
@@ -1,4 +1,6 @@
1 1
 0.1743
2
+    - fixed bug that update_all can't receive parameter as first argument
3
+    - fixed bug that delete_all can't receive parameter as first argument
2 4
     - fixed where clause parsing bug when time(like 00:00:00) contain
3 5
 0.1742
4 6
     - fixed update_or_insert method bug
+2 -2
lib/DBIx/Custom.pm
... ...
@@ -264,7 +264,7 @@ sub delete {
264 264
     $self->execute($sql, $w->{param}, %opt);
265 265
 }
266 266
 
267
-sub delete_all { shift->delete(allow_delete_all => 1, @_) }
267
+sub delete_all { shift->delete(@_, allow_delete_all => 1) }
268 268
 
269 269
 sub DESTROY {}
270 270
 
... ...
@@ -1155,7 +1155,7 @@ sub update {
1155 1155
     $self->execute($sql, [$param, $w->{param}], %opt);
1156 1156
 }
1157 1157
 
1158
-sub update_all { shift->update(allow_update_all => 1, @_) };
1158
+sub update_all { shift->update(@_, allow_update_all => 1) };
1159 1159
 
1160 1160
 sub update_or_insert {
1161 1161
     my ($self, $param, %opt) = @_;
+60 -60
t/common.t
... ...
@@ -661,7 +661,7 @@ $dbi->register_filter(
661 661
     three_times => sub { $_[0] * 3 }
662 662
 );
663 663
 $dbi->default_bind_filter('twice');
664
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, filter => {$key1 => 'three_times'});
664
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, filter => {$key1 => 'three_times'});
665 665
 $result = $dbi->execute("select * from $table1");
666 666
 $rows   = $result->all;
667 667
 is_deeply($rows, [{$key1 => 3, $key2 => 4}], "filter");
... ...
@@ -672,7 +672,7 @@ eval { $dbi->execute("drop table $table1") };
672 672
 $dbi->execute($create_table1_2);
673 673
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
674 674
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
675
-$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1});
675
+$dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1});
676 676
 $result = $dbi->execute("select * from $table1 order by $key1");
677 677
 $rows   = $result->all;
678 678
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
... ...
@@ -682,14 +682,14 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
682 682
 $dbi->execute("delete from $table1");
683 683
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
684 684
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
685
-$dbi->update(table => $table1, param => {$key2 => 12}, where => {$key2 => 2, $key3 => 3});
685
+$dbi->update({$key2 => 12}, table => $table1, where => {$key2 => 2, $key3 => 3});
686 686
 $result = $dbi->execute("select * from $table1 order by $key1");
687 687
 $rows   = $result->all;
688 688
 is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
689 689
                   {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
690 690
                   "update key same as search key");
691 691
 
692
-$dbi->update(table => $table1, param => {$key2 => [12]}, where => {$key2 => 2, $key3 => 3});
692
+$dbi->update({$key2 => [12]}, table => $table1, where => {$key2 => 2, $key3 => 3});
693 693
 $result = $dbi->execute("select * from $table1 order by $key1");
694 694
 $rows   = $result->all;
695 695
 is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
... ...
@@ -700,7 +700,7 @@ $dbi->execute("delete from $table1");
700 700
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
701 701
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
702 702
 $dbi->register_filter(twice => sub { $_[0] * 2 });
703
-$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1},
703
+$dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1},
704 704
               filter => {$key2 => sub { $_[0] * 2 }});
705 705
 $result = $dbi->execute("select * from $table1 order by $key1");
706 706
 $rows   = $result->all;
... ...
@@ -708,7 +708,7 @@ is_deeply($rows, [{$key1 => 1, $key2 => 22, $key3 => 3, $key4 => 4, $key5 => 5},
708 708
                   {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
709 709
                   "filter");
710 710
 
711
-$result = $dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1}, append => '   ');
711
+$result = $dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1}, append => '   ');
712 712
 
713 713
 eval{$dbi->update(table => $table1)};
714 714
 like($@, qr/where/, "not contain where");
... ...
@@ -719,7 +719,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
719 719
 $where = $dbi->where;
720 720
 $where->clause(['and', "$key1 = :$key1", "$key2 = :$key2"]);
721 721
 $where->param({$key1 => 1, $key2 => 2});
722
-$dbi->update(table => $table1, param => {$key1 => 3}, where => $where);
722
+$dbi->update({$key1 => 3}, table => $table1, where => $where);
723 723
 $result = $dbi->select(table => $table1);
724 724
 is_deeply($result->all, [{$key1 => 3, $key2 => 2}], 'update() where');
725 725
 
... ...
@@ -727,8 +727,8 @@ eval { $dbi->execute("drop table $table1") };
727 727
 $dbi->execute($create_table1);
728 728
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
729 729
 $dbi->update(
730
+    {$key1 => 3},
730 731
     table => $table1,
731
-    param => {$key1 => 3},
732 732
     where => [
733 733
         ['and', "$key1 = :$key1", "$key2 = :$key2"],
734 734
         {$key1 => 1, $key2 => 2}
... ...
@@ -743,14 +743,14 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
743 743
 $where = $dbi->where;
744 744
 $where->clause(['and', "$key2 = :$key2"]);
745 745
 $where->param({$key2 => 2});
746
-$dbi->update(table => $table1, param => {$key1 => 3}, where => $where);
746
+$dbi->update({$key1 => 3}, table => $table1, where => $where);
747 747
 $result = $dbi->select(table => $table1);
748 748
 is_deeply($result->all, [{$key1 => 3, $key2 => 2}], 'update() where');
749 749
 
750
-eval{$dbi->update(table => $table1, param => {';' => 1}, where => {$key1 => 1})};
750
+eval{$dbi->update({';' => 1}, table => $table1, where => {$key1 => 1})};
751 751
 like($@, qr/safety/);
752 752
 
753
-eval{$dbi->update(table => $table1, param => {$key1 => 1}, where => {';' => 1})};
753
+eval{$dbi->update({$key1 => 1}, table => $table1, where => {';' => 1})};
754 754
 like($@, qr/safety/);
755 755
 
756 756
 eval { $dbi->execute("drop table $table1") };
... ...
@@ -758,21 +758,21 @@ eval { $dbi->execute("drop table ${q}table$p") };
758 758
 $dbi->execute($create_table_reserved);
759 759
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
760 760
 $dbi->apply_filter('table', update => {out => sub { $_[0] * 3}});
761
-$dbi->insert(table => 'table', param => {select => 1});
762
-$dbi->update(table => 'table', where => {select => 1}, param => {update => 2});
761
+$dbi->insert({select => 1}, table => 'table');
762
+$dbi->update({update => 2}, table => 'table', where => {select => 1});
763 763
 $result = $dbi->execute("select * from ${q}table$p");
764 764
 $rows   = $result->all;
765 765
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
766 766
 
767
-eval {$dbi->update_all(table => 'table', param => {';' => 2}) };
767
+eval {$dbi->update_all({';' => 2}, table => 'table') };
768 768
 like($@, qr/safety/);
769 769
 
770 770
 eval { $dbi->execute("drop table ${q}table$p") };
771 771
 $dbi->execute($create_table_reserved);
772 772
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
773 773
 $dbi->apply_filter('table', update => {out => sub { $_[0] * 3}});
774
-$dbi->insert(table => 'table', param => {select => 1});
775
-$dbi->update(table => 'table', where => {'table.select' => 1}, param => {update => 2});
774
+$dbi->insert({select => 1}, table => 'table');
775
+$dbi->update({update => 2}, table => 'table', where => {'table.select' => 1});
776 776
 $result = $dbi->execute("select * from ${q}table$p");
777 777
 $rows   = $result->all;
778 778
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
... ...
@@ -792,7 +792,7 @@ eval { $dbi->execute("drop table $table1") };
792 792
 $dbi->execute($create_table1_2);
793 793
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
794 794
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
795
-$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1},
795
+$dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1},
796 796
 wrap => {$key2 => sub { "$_[0] - 1" }});
797 797
 $result = $dbi->execute("select * from $table1 order by $key1");
798 798
 $rows   = $result->all;
... ...
@@ -804,7 +804,7 @@ eval { $dbi->execute("drop table $table1") };
804 804
 $dbi->execute($create_table1_2);
805 805
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
806 806
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
807
-$dbi->update(table => $table1, param => {$key2 => \"'11'"}, where => {$key1 => 1});
807
+$dbi->update({$key2 => \"'11'"}, table => $table1, where => {$key1 => 1});
808 808
 $result = $dbi->execute("select * from $table1 order by $key1");
809 809
 $rows   = $result->all;
810 810
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
... ...
@@ -873,8 +873,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
873 873
 eval { $dbi->execute("drop table $table1") };
874 874
 $dbi->execute($create_table1_2);
875 875
 $param = {$key3 => 4};
876
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
877
-$dbi->update(table => $table1, param => $param, updated_at => $key2, where => {$key1 => 1});
876
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
877
+$dbi->update($param, table => $table1, updated_at => $key2, where => {$key1 => 1});
878 878
 $result = $dbi->select(table => $table1);
879 879
 is_deeply($param, {$key3 => 4});
880 880
 $row   = $result->one;
... ...
@@ -884,8 +884,8 @@ like($row->{$key2}, qr/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
884 884
 eval { $dbi->execute("drop table $table1") };
885 885
 $dbi->execute($create_table1_2);
886 886
 $param = {$key3 => 4};
887
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
888
-$dbi->update(table => $table1, param => $param, updated_at => $key2, where => {$key3 => 3});
887
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
888
+$dbi->update($param, table => $table1, updated_at => $key2, where => {$key3 => 3});
889 889
 $result = $dbi->select(table => $table1);
890 890
 is_deeply($param, {$key3 => 4});
891 891
 $row   = $result->one;
... ...
@@ -896,7 +896,7 @@ eval { $dbi->execute("drop table $table1") };
896 896
 $dbi->execute($create_table1_2);
897 897
 $model = $dbi->create_model(table => $table1, updated_at => $key2);
898 898
 $param = {$key3 => 4};
899
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
899
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
900 900
 $model->update($param, where => {$key1 => 1});
901 901
 $result = $dbi->select(table => $table1);
902 902
 is_deeply($param, {$key3 => 4});
... ...
@@ -910,7 +910,7 @@ $dbi->execute($create_table1_2);
910 910
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
911 911
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
912 912
 $dbi->register_filter(twice => sub { $_[0] * 2 });
913
-$dbi->update_all(table => $table1, param => {$key2 => 10}, filter => {$key2 => 'twice'});
913
+$dbi->update_all({$key2 => 10}, table => $table1, filter => {$key2 => 'twice'});
914 914
 $result = $dbi->execute("select * from $table1");
915 915
 $rows   = $result->all;
916 916
 is_deeply($rows, [{$key1 => 1, $key2 => 20, $key3 => 3, $key4 => 4, $key5 => 5},
... ...
@@ -993,7 +993,7 @@ $dbi = DBIx::Custom->connect;
993 993
 eval { $dbi->execute("drop table ${q}table$p") };
994 994
 $dbi->execute($create_table_reserved);
995 995
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
996
-$dbi->insert(table => 'table', param => {select => 1});
996
+$dbi->insert({select => 1}, table => 'table');
997 997
 $dbi->delete(table => 'table', where => {select => 1});
998 998
 $result = $dbi->execute("select * from ${q}table$p");
999 999
 $rows   = $result->all;
... ...
@@ -1035,7 +1035,7 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}], "filter");
1035 1035
 
1036 1036
 eval { $dbi->execute("drop table $table2") };
1037 1037
 $dbi->execute($create_table2);
1038
-$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
1038
+$dbi->insert({$key1 => 1, $key3 => 5}, table => $table2);
1039 1039
 $rows = $dbi->select(
1040 1040
     table => [$table1, $table2],
1041 1041
     column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
... ...
@@ -1055,7 +1055,7 @@ $dbi = DBIx::Custom->connect;
1055 1055
 eval { $dbi->execute("drop table ${q}table$p") };
1056 1056
 $dbi->execute($create_table_reserved);
1057 1057
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
1058
-$dbi->insert(table => 'table', param => {select => 1, update => 2});
1058
+$dbi->insert({select => 1, update => 2}, table => 'table');
1059 1059
 $result = $dbi->select(table => 'table', where => {select => 1});
1060 1060
 $rows   = $result->all;
1061 1061
 is_deeply($rows, [{select => 2, update => 2}], "reserved word");
... ...
@@ -1103,7 +1103,7 @@ $dbi->execute($create_table1);
1103 1103
 $dbi->begin_work;
1104 1104
 $dbi->dbh->{AutoCommit} = 0;
1105 1105
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1106
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
1106
+$dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
1107 1107
 $dbi->commit;
1108 1108
 $dbi->dbh->{AutoCommit} = 1;
1109 1109
 $result = $dbi->select(table => $table1);
... ...
@@ -1127,7 +1127,7 @@ $dbi->execute($create_table1);
1127 1127
 
1128 1128
 $query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1);
1129 1129
 $dbi->dbh->disconnect;
1130
-eval{$dbi->execute($query, param => {$key1 => {a => 1}})};
1130
+eval{$dbi->execute($query, {$key1 => {a => 1}})};
1131 1131
 ok($@, "execute fail");
1132 1132
 
1133 1133
 {
... ...
@@ -1212,7 +1212,7 @@ $dbi->execute($create_table1);
1212 1212
 
1213 1213
 $query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1);
1214 1214
 $dbi->dbh->disconnect;
1215
-eval{$dbi->execute($query, param => {$key1 => {a => 1}})};
1215
+eval{$dbi->execute($query, {$key1 => {a => 1}})};
1216 1216
 ok($@, "execute fail");
1217 1217
 
1218 1218
 {
... ...
@@ -1287,8 +1287,8 @@ $dbi->register_filter(twice => sub { $_[0] * 2 });
1287 1287
 $dbi->apply_filter(
1288 1288
     $table1, $key1 => {out => 'twice', in => 'twice'}
1289 1289
 );
1290
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, filter => {$key1 => undef});
1291
-$dbi->update(table => $table1, param => {$key1 => 2}, where => {$key2 => 2});
1290
+$dbi->insert({$key1 => 1, $key2 => 2},table => $table1, filter => {$key1 => undef});
1291
+$dbi->update({$key1 => 2}, table => $table1, where => {$key2 => 2});
1292 1292
 $result = $dbi->execute("select * from $table1");
1293 1293
 $row   = $result->one;
1294 1294
 is_deeply($row, {$key1 => 4, $key2 => 2}, "update");
... ...
@@ -1300,7 +1300,7 @@ $dbi->register_filter(twice => sub { $_[0] * 2 });
1300 1300
 $dbi->apply_filter(
1301 1301
     $table1, $key1 => {out => 'twice', in => 'twice'}
1302 1302
 );
1303
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1=> undef});
1303
+$dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1=> undef});
1304 1304
 $dbi->delete(table => $table1, where => {$key1 => 1});
1305 1305
 $result = $dbi->execute("select * from $table1");
1306 1306
 $rows   = $result->all;
... ...
@@ -1313,7 +1313,7 @@ $dbi->register_filter(twice => sub { $_[0] * 2 });
1313 1313
 $dbi->apply_filter(
1314 1314
     $table1, $key1 => {out => 'twice', in => 'twice'}
1315 1315
 );
1316
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1 => undef});
1316
+$dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1317 1317
 $result = $dbi->select(table => $table1, where => {$key1 => 1});
1318 1318
 $result->filter({$key2 => 'twice'});
1319 1319
 $rows   = $result->all;
... ...
@@ -1326,9 +1326,9 @@ $dbi->register_filter(twice => sub { $_[0] * 2 });
1326 1326
 $dbi->apply_filter(
1327 1327
     $table1, $key1 => {out => 'twice', in => 'twice'}
1328 1328
 );
1329
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1 => undef});
1329
+$dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1330 1330
 $result = $dbi->execute("select * from $table1 where $key1 = :$key1 and $key2 = :$key2",
1331
-                        param => {$key1 => 1, $key2 => 2},
1331
+                        {$key1 => 1, $key2 => 2},
1332 1332
                         table => [$table1]);
1333 1333
 $rows   = $result->all;
1334 1334
 is_deeply($rows, [{$key1 => 4, $key2 => 2}], "execute");
... ...
@@ -1340,9 +1340,9 @@ $dbi->register_filter(twice => sub { $_[0] * 2 });
1340 1340
 $dbi->apply_filter(
1341 1341
     $table1, $key1 => {out => 'twice', in => 'twice'}
1342 1342
 );
1343
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1 => undef});
1343
+$dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1344 1344
 $result = $dbi->execute("select * from {table $table1} where $key1 = :$key1 and $key2 = :$key2",
1345
-                        param => {$key1 => 1, $key2 => 2});
1345
+                        {$key1 => 1, $key2 => 2});
1346 1346
 $rows   = $result->all;
1347 1347
 is_deeply($rows, [{$key1 => 4, $key2 => 2}], "execute table tag");
1348 1348
 
... ...
@@ -1359,8 +1359,8 @@ $dbi->apply_filter(
1359 1359
 $dbi->apply_filter(
1360 1360
     $table2, $key3 => {out => 'three_times', in => 'three_times'}
1361 1361
 );
1362
-$dbi->insert(table => $table1, param => {$key1 => 5, $key2 => 2}, filter => {$key2 => undef});
1363
-$dbi->insert(table => $table2, param => {$key1 => 5, $key3 => 6}, filter => {$key3 => undef});
1362
+$dbi->insert({$key1 => 5, $key2 => 2}, table => $table1, filter => {$key2 => undef});
1363
+$dbi->insert({$key1 => 5, $key3 => 6}, table => $table2, filter => {$key3 => undef});
1364 1364
 $result = $dbi->select(
1365 1365
      table => [$table1, $table2],
1366 1366
      column => [$key2, $key3],
... ...
@@ -1486,9 +1486,9 @@ test 'select query option';
1486 1486
 $dbi = DBIx::Custom->connect;
1487 1487
 eval { $dbi->execute("drop table $table1") };
1488 1488
 $dbi->execute($create_table1);
1489
-$query = $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, query => 1);
1489
+$query = $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, query => 1);
1490 1490
 is(ref $query, 'DBIx::Custom::Query');
1491
-$query = $dbi->update(table => $table1, where => {$key1 => 1}, param => {$key2 => 2}, query => 1);
1491
+$query = $dbi->update({$key2 => 2}, table => $table1, where => {$key1 => 1}, query => 1);
1492 1492
 is(ref $query, 'DBIx::Custom::Query');
1493 1493
 $query = $dbi->delete(table => $table1, where => {$key1 => 1}, query => 1);
1494 1494
 is(ref $query, 'DBIx::Custom::Query');
... ...
@@ -1792,8 +1792,8 @@ is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1792 1792
 $dbi = DBIx::Custom->connect;
1793 1793
 eval { $dbi->execute("drop table $table1") };
1794 1794
 $dbi->execute($create_table1);
1795
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => '00:00:00'});
1796
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => '3'});
1795
+$dbi->insert({$key1 => 1, $key2 => '00:00:00'}, table => $table1);
1796
+$dbi->insert({$key1 => 1, $key2 => '3'}, table => $table1);
1797 1797
 $where = $dbi->where
1798 1798
              ->clause(['and', "$key1 = :$key1", "$key2 = '00:00:00'"])
1799 1799
              ->param({$key1 => 1});
... ...
@@ -1869,11 +1869,11 @@ $dbi = DBIx::Custom->connect;
1869 1869
 eval { $dbi->execute("drop table $table1") };
1870 1870
 $dbi->execute($create_table1);
1871 1871
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1872
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2},
1872
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
1873 1873
              filter => {$key1 => 'twice'});
1874 1874
 $row = $dbi->select(table => $table1)->one;
1875 1875
 is_deeply($row, {$key1 => 2, $key2 => 2});
1876
-eval {$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2},
1876
+eval {$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
1877 1877
              filter => {$key1 => 'no'}) };
1878 1878
 like($@, qr//);
1879 1879
 
... ...
@@ -1925,7 +1925,7 @@ test 'delete_at';
1925 1925
 $dbi = DBIx::Custom->connect;
1926 1926
 eval { $dbi->execute("drop table $table1") };
1927 1927
 $dbi->execute($create_table1_2);
1928
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
1928
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
1929 1929
 $dbi->delete_at(
1930 1930
     table => $table1,
1931 1931
     primary_key => [$key1, $key2],
... ...
@@ -1933,7 +1933,7 @@ $dbi->delete_at(
1933 1933
 );
1934 1934
 is_deeply($dbi->select(table => $table1)->all, []);
1935 1935
 
1936
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
1936
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
1937 1937
 $dbi->delete_at(
1938 1938
     table => $table1,
1939 1939
     primary_key => $key1,
... ...
@@ -2406,8 +2406,8 @@ eval { $dbi->execute("drop table $table1") };
2406 2406
 $dbi->execute($create_table1);
2407 2407
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2408 2408
 $dbi->update(
2409
+    {$key1 => 5},
2409 2410
     table => $table1,
2410
-    param => {$key1 => 5},
2411 2411
     where => [
2412 2412
         "$key1 = :$key1 and $key2 = :$key2",
2413 2413
         {$key1 => 1, $key2 => 2}
... ...
@@ -2421,10 +2421,10 @@ $dbi = DBIx::Custom->connect;
2421 2421
 eval { $dbi->execute("drop table $table1") };
2422 2422
 $dbi->execute($create_table1_2);
2423 2423
 $dbi->insert(
2424
+    {$key3 => 3},
2424 2425
     primary_key => [$key1, $key2], 
2425 2426
     table => $table1,
2426 2427
     id => [1, 2],
2427
-    param => {$key3 => 3}
2428 2428
 );
2429 2429
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2430 2430
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2432,10 +2432,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 3);
2432 2432
 
2433 2433
 $dbi->delete_all(table => $table1);
2434 2434
 $dbi->insert(
2435
+    {$key2 => 2, $key3 => 3},
2435 2436
     primary_key => $key1, 
2436 2437
     table => $table1,
2437 2438
     id => 0,
2438
-    param => {$key2 => 2, $key3 => 3}
2439 2439
 );
2440 2440
 
2441 2441
 is($dbi->select(table => $table1)->one->{$key1}, 0);
... ...
@@ -2489,8 +2489,8 @@ $dbi = MyDBI6->connect;
2489 2489
 eval { $dbi->execute("drop table $table1") };
2490 2490
 $dbi->execute($create_table1_2);
2491 2491
 $dbi->model($table1)->insert(
2492
+    {$key3 => 3},
2492 2493
     id => [1, 2],
2493
-    param => {$key3 => 3}
2494 2494
 );
2495 2495
 $result = $dbi->model($table1)->select;
2496 2496
 $row = $result->one;
... ...
@@ -2515,7 +2515,7 @@ test 'update and id option';
2515 2515
 $dbi = DBIx::Custom->connect;
2516 2516
 eval { $dbi->execute("drop table $table1") };
2517 2517
 $dbi->execute($create_table1_2);
2518
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2518
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2519 2519
 $dbi->update(
2520 2520
     table => $table1,
2521 2521
     primary_key => [$key1, $key2],
... ...
@@ -2541,7 +2541,7 @@ is($dbi->select(table => $table1)->one->{$key3}, 4);
2541 2541
 $dbi = DBIx::Custom->connect;
2542 2542
 eval { $dbi->execute("drop table $table1") };
2543 2543
 $dbi->execute($create_table1_2);
2544
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2544
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2545 2545
 $dbi->update(
2546 2546
     {$key3 => 4},
2547 2547
     table => $table1,
... ...
@@ -2557,7 +2557,7 @@ test 'model update and id option';
2557 2557
 $dbi = MyDBI6->connect;
2558 2558
 eval { $dbi->execute("drop table $table1") };
2559 2559
 $dbi->execute($create_table1_2);
2560
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2560
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2561 2561
 $dbi->model($table1)->update(
2562 2562
     id => [1, 2],
2563 2563
     param => {$key3 => 4}
... ...
@@ -2573,7 +2573,7 @@ test 'delete and id option';
2573 2573
 $dbi = DBIx::Custom->connect;
2574 2574
 eval { $dbi->execute("drop table $table1") };
2575 2575
 $dbi->execute($create_table1_2);
2576
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2576
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2577 2577
 $dbi->delete(
2578 2578
     table => $table1,
2579 2579
     primary_key => [$key1, $key2],
... ...
@@ -2598,7 +2598,7 @@ eval { $dbi->execute("drop table $table3") };
2598 2598
 $dbi->execute($create_table1_2);
2599 2599
 $dbi->execute($create_table2_2);
2600 2600
 $dbi->execute($create_table3);
2601
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2601
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2602 2602
 $dbi->model($table1)->delete(id => [1, 2]);
2603 2603
 is_deeply($dbi->select(table => $table1)->all, []);
2604 2604
 $dbi->insert(table => $table2, param => {$key1 => 1, $key2 => 2, $key3 => 3});
... ...
@@ -2613,7 +2613,7 @@ test 'select and id option';
2613 2613
 $dbi = DBIx::Custom->connect;
2614 2614
 eval { $dbi->execute("drop table $table1") };
2615 2615
 $dbi->execute($create_table1_2);
2616
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2616
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2617 2617
 $result = $dbi->select(
2618 2618
     table => $table1,
2619 2619
     primary_key => [$key1, $key2],
... ...
@@ -2637,7 +2637,7 @@ is($row->{$key2}, 2);
2637 2637
 is($row->{$key3}, 3);
2638 2638
 
2639 2639
 $dbi->delete_all(table => $table1);
2640
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2640
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2641 2641
 $result = $dbi->select(
2642 2642
     table => $table1,
2643 2643
     primary_key => [$key1, $key2],
... ...
@@ -2653,7 +2653,7 @@ test 'model select_at';
2653 2653
 $dbi = MyDBI6->connect;
2654 2654
 eval { $dbi->execute("drop table $table1") };
2655 2655
 $dbi->execute($create_table1_2);
2656
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
2656
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2657 2657
 $result = $dbi->model($table1)->select(id => [1, 2]);
2658 2658
 $row = $result->one;
2659 2659
 is($row->{$key1}, 1);