Showing 3 changed files with 32 additions and 16 deletions
+2
Changes
... ...
@@ -1,4 +1,6 @@
1 1
 0.1667
2
+    - renamed update_param to update_param_tag, update_param is DEPRECATED!
3
+    - renamed insert_param to insert_param_tag, insert_param is DEPRECATED!
2 4
     - added EXPERIMENTAL updat_param no_set option.
3 5
     - added EXPERIMENTAL reserved_word_quote attribute.
4 6
 0.1666
+23 -9
lib/DBIx/Custom.pm
... ...
@@ -1,6 +1,6 @@
1 1
 package DBIx::Custom;
2 2
 
3
-our $VERSION = '0.1668';
3
+our $VERSION = '0.1669';
4 4
 
5 5
 use 5.008001;
6 6
 use strict;
... ...
@@ -651,7 +651,7 @@ sub insert_at {
651 651
     return $self->insert(param => $param, %args);
652 652
 }
653 653
 
654
-sub insert_param {
654
+sub insert_param_tag {
655 655
     my ($self, $param) = @_;
656 656
     
657 657
     # Insert parameter tag
... ...
@@ -1178,7 +1178,7 @@ sub update_at {
1178 1178
     return $self->update(where => $where, param => $param, %args);
1179 1179
 }
1180 1180
 
1181
-sub update_param {
1181
+sub update_param_tag {
1182 1182
     my ($self, $param, $opt) = @_;
1183 1183
     
1184 1184
     # Insert parameter tag
... ...
@@ -1463,11 +1463,24 @@ sub default_fetch_filter {
1463 1463
     return $self->{default_in_filter};
1464 1464
 }
1465 1465
 
1466
+# DEPRECATED!
1467
+sub insert_param {
1468
+    warn "insert_param is renamed to insert_param_tag."
1469
+       . " insert_param is DEPRECATED!";
1470
+    return shift->insert_param_tag(@_);
1471
+}
1472
+
1466 1473
 # DEPRECATED!
1467 1474
 sub register_tag_processor {
1468 1475
     return shift->query_builder->register_tag_processor(@_);
1469 1476
 }
1470 1477
 
1478
+# DEPRECATED!
1479
+sub update_param {
1480
+    warn "update_param is renamed to update_param_tag."
1481
+       . " update_param is DEPRECATED!";
1482
+    return shift->update_param_tag(@_);
1483
+}
1471 1484
 # DEPRECATED!
1472 1485
 sub _push_relation {
1473 1486
     my ($self, $sql, $tables, $relation, $need_where) = @_;
... ...
@@ -2172,9 +2185,9 @@ Place holders are set to 5 and 'Perl'.
2172 2185
 
2173 2186
 =back
2174 2187
 
2175
-=head2 C<insert_param>
2188
+=head2 C<insert_param_tag>
2176 2189
 
2177
-    my $insert_param = $dbi->insert_param({title => 'a', age => 2});
2190
+    my $insert_param_tag = $dbi->insert_param_tag({title => 'a', age => 2});
2178 2191
 
2179 2192
 Create insert parameter tag.
2180 2193
 
... ...
@@ -2741,17 +2754,18 @@ Place holders are set to 'Perl' and 5.
2741 2754
 
2742 2755
 =back
2743 2756
 
2744
-=head2 C<update_param>
2757
+=head2 C<update_param_tag>
2745 2758
 
2746
-    my $update_param = $dbi->update_param({title => 'a', age => 2});
2759
+    my $update_param_tag = $dbi->update_param_tag({title => 'a', age => 2});
2747 2760
 
2748 2761
 Create update parameter tag.
2749 2762
 
2750 2763
     set title = {? title}, author = {? author}
2751 2764
 
2752
-You can create tag without 'set ' by C<no_set> option. This option is EXPERIMENTAL.
2765
+You can create tag without 'set '
2766
+by C<no_set> option. This option is EXPERIMENTAL.
2753 2767
 
2754
-    my $update_param = $dbi->update_param(
2768
+    my $update_param_tag = $dbi->update_param_tag(
2755 2769
         {title => 'a', age => 2}
2756 2770
         {no_set => 1}
2757 2771
     );
+7 -7
t/dbix-custom-core-sqlite.t
... ...
@@ -1775,7 +1775,7 @@ $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4
1775 1775
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
1776 1776
 
1777 1777
 $param = {key2 => 11};
1778
-$update_param = $dbi->update_param($param);
1778
+$update_param = $dbi->update_param_tag($param);
1779 1779
 $sql = <<"EOS";
1780 1780
 update {table table1} $update_param
1781 1781
 where key1 = 1
... ...
@@ -1794,7 +1794,7 @@ $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4
1794 1794
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
1795 1795
 
1796 1796
 $param = {key2 => 11, key3 => 33};
1797
-$update_param = $dbi->update_param($param);
1797
+$update_param = $dbi->update_param_tag($param);
1798 1798
 $sql = <<"EOS";
1799 1799
 update {table table1} $update_param
1800 1800
 where key1 = 1
... ...
@@ -1812,7 +1812,7 @@ $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4
1812 1812
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
1813 1813
 
1814 1814
 $param = {key2 => 11, key3 => 33};
1815
-$update_param = $dbi->update_param($param, {no_set => 1});
1815
+$update_param = $dbi->update_param_tag($param, {no_set => 1});
1816 1816
 $sql = <<"EOS";
1817 1817
 update {table table1} set $update_param
1818 1818
 where key1 = 1
... ...
@@ -1825,7 +1825,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 33, key4 => 4, key5 => 5},
1825 1825
                   "update param no_set");
1826 1826
 
1827 1827
             
1828
-eval { $dbi->update_param({";" => 1}) };
1828
+eval { $dbi->update_param_tag({";" => 1}) };
1829 1829
 like($@, qr/not safety/);
1830 1830
 
1831 1831
 
... ...
@@ -1833,7 +1833,7 @@ test 'insert_param';
1833 1833
 $dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1834 1834
 $dbi->execute($CREATE_TABLE->{1});
1835 1835
 $param = {key1 => 1, key2 => 2};
1836
-$insert_param = $dbi->insert_param($param);
1836
+$insert_param = $dbi->insert_param_tag($param);
1837 1837
 $sql = <<"EOS";
1838 1838
 insert into {table table1} $insert_param
1839 1839
 EOS
... ...
@@ -1845,7 +1845,7 @@ $dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1845 1845
 $dbi->reserved_word_quote('"');
1846 1846
 $dbi->execute($CREATE_TABLE->{1});
1847 1847
 $param = {key1 => 1, key2 => 2};
1848
-$insert_param = $dbi->insert_param($param);
1848
+$insert_param = $dbi->insert_param_tag($param);
1849 1849
 $sql = <<"EOS";
1850 1850
 insert into {table table1} $insert_param
1851 1851
 EOS
... ...
@@ -1853,7 +1853,7 @@ $dbi->execute($sql, param => $param);
1853 1853
 is($dbi->select(table => 'table1')->fetch_hash_first->{key1}, 1);
1854 1854
 is($dbi->select(table => 'table1')->fetch_hash_first->{key2}, 2);
1855 1855
 
1856
-eval { $dbi->insert_param({";" => 1}) };
1856
+eval { $dbi->insert_param_tag({";" => 1}) };
1857 1857
 like($@, qr/not safety/);
1858 1858
 
1859 1859