- removed argument checking logic because in databa...
...se performance is more
... | ... |
@@ -1,3 +1,6 @@ |
1 |
+0.1733 |
|
2 |
+ - removed argument checking logic because in database performance is more |
|
3 |
+ important. |
|
1 | 4 |
0.1732 |
2 | 5 |
- removed EXPERIMETNAL flag from like_value |
3 | 6 |
0.1731 |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
package DBIx::Custom; |
2 | 2 |
use Object::Simple -base; |
3 | 3 |
|
4 |
-our $VERSION = '0.1732'; |
|
4 |
+our $VERSION = '0.1733'; |
|
5 | 5 |
use 5.008001; |
6 | 6 |
|
7 | 7 |
use Carp 'croak'; |
... | ... |
@@ -370,11 +370,6 @@ sub each_table { |
370 | 370 |
} |
371 | 371 |
} |
372 | 372 |
|
373 |
-our %VALID_ARGS = map { $_ => 1 } qw/append after_build_sql allow_delete_all |
|
374 |
- allow_update_all bind_type column filter id join param prefix primary_key |
|
375 |
- query relation sqlfilter table table_alias timestamp type type_rule_off |
|
376 |
- type_rule1_off type_rule2_off wrap/; |
|
377 |
- |
|
378 | 373 |
sub execute { |
379 | 374 |
my $self = shift; |
380 | 375 |
my $sql = shift; |
... | ... |
@@ -408,12 +403,6 @@ sub execute { |
408 | 403 |
$primary_key = [$primary_key] unless ref $primary_key eq 'ARRAY'; |
409 | 404 |
my $append = delete $args{append}; |
410 | 405 |
$sql .= $append if defined $append && !ref $sql; |
411 |
- |
|
412 |
- # Check argument names |
|
413 |
- foreach my $name (keys %args) { |
|
414 |
- croak qq{"$name" is wrong option } . _subname |
|
415 |
- unless $VALID_ARGS{$name}; |
|
416 |
- } |
|
417 | 406 |
|
418 | 407 |
my $query |
419 | 408 |
= ref $sql ? $sql : $self->_create_query($sql, $after_build_sql); |
... | ... |
@@ -1747,7 +1736,6 @@ sub apply_filter { |
1747 | 1736 |
} |
1748 | 1737 |
|
1749 | 1738 |
# DEPRECATED! |
1750 |
-our %SELECT_AT_ARGS = (%VALID_ARGS, where => 1, primary_key => 1); |
|
1751 | 1739 |
sub select_at { |
1752 | 1740 |
my ($self, %args) = @_; |
1753 | 1741 |
|
... | ... |
@@ -1759,12 +1747,6 @@ sub select_at { |
1759 | 1747 |
my $where = delete $args{where}; |
1760 | 1748 |
my $param = delete $args{param}; |
1761 | 1749 |
|
1762 |
- # Check arguments |
|
1763 |
- foreach my $name (keys %args) { |
|
1764 |
- croak qq{"$name" is wrong option } . _subname |
|
1765 |
- unless $SELECT_AT_ARGS{$name}; |
|
1766 |
- } |
|
1767 |
- |
|
1768 | 1750 |
# Table |
1769 | 1751 |
croak qq{"table" option must be specified } . _subname |
1770 | 1752 |
unless $args{table}; |
... | ... |
@@ -1777,7 +1759,6 @@ sub select_at { |
1777 | 1759 |
} |
1778 | 1760 |
|
1779 | 1761 |
# DEPRECATED! |
1780 |
-our %DELETE_AT_ARGS = (%VALID_ARGS, where => 1, primary_key => 1); |
|
1781 | 1762 |
sub delete_at { |
1782 | 1763 |
my ($self, %args) = @_; |
1783 | 1764 |
|
... | ... |
@@ -1788,12 +1769,6 @@ sub delete_at { |
1788 | 1769 |
$primary_keys = [$primary_keys] unless ref $primary_keys; |
1789 | 1770 |
my $where = delete $args{where}; |
1790 | 1771 |
|
1791 |
- # Check arguments |
|
1792 |
- foreach my $name (keys %args) { |
|
1793 |
- croak qq{"$name" is wrong option } . _subname |
|
1794 |
- unless $DELETE_AT_ARGS{$name}; |
|
1795 |
- } |
|
1796 |
- |
|
1797 | 1772 |
# Create where parameter |
1798 | 1773 |
my $where_param = $self->_create_param_from_id($where, $primary_keys); |
1799 | 1774 |
|
... | ... |
@@ -1801,7 +1776,6 @@ sub delete_at { |
1801 | 1776 |
} |
1802 | 1777 |
|
1803 | 1778 |
# DEPRECATED! |
1804 |
-our %UPDATE_AT_ARGS = (%VALID_ARGS, where => 1, primary_key => 1); |
|
1805 | 1779 |
sub update_at { |
1806 | 1780 |
my $self = shift; |
1807 | 1781 |
|
... | ... |
@@ -1817,12 +1791,6 @@ sub update_at { |
1817 | 1791 |
my $p = delete $args{param} || {}; |
1818 | 1792 |
$param ||= $p; |
1819 | 1793 |
|
1820 |
- # Check arguments |
|
1821 |
- foreach my $name (keys %args) { |
|
1822 |
- croak qq{"$name" is wrong option } . _subname |
|
1823 |
- unless $UPDATE_AT_ARGS{$name}; |
|
1824 |
- } |
|
1825 |
- |
|
1826 | 1794 |
# Create where parameter |
1827 | 1795 |
my $where_param = $self->_create_param_from_id($where, $primary_keys); |
1828 | 1796 |
|
... | ... |
@@ -1830,7 +1798,6 @@ sub update_at { |
1830 | 1798 |
} |
1831 | 1799 |
|
1832 | 1800 |
# DEPRECATED! |
1833 |
-our %INSERT_AT_ARGS = (%VALID_ARGS, where => 1, primary_key => 1); |
|
1834 | 1801 |
sub insert_at { |
1835 | 1802 |
my $self = shift; |
1836 | 1803 |
|
... | ... |
@@ -1846,12 +1813,6 @@ sub insert_at { |
1846 | 1813 |
my $p = delete $args{param} || {}; |
1847 | 1814 |
$param ||= $p; |
1848 | 1815 |
|
1849 |
- # Check arguments |
|
1850 |
- foreach my $name (keys %args) { |
|
1851 |
- croak qq{"$name" is wrong option } . _subname |
|
1852 |
- unless $INSERT_AT_ARGS{$name}; |
|
1853 |
- } |
|
1854 |
- |
|
1855 | 1816 |
# Create where parameter |
1856 | 1817 |
my $where_param = $self->_create_param_from_id($where, $primary_key); |
1857 | 1818 |
$param = $self->merge_param($where_param, $param); |
... | ... |
@@ -469,9 +469,6 @@ $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, append => ' |
469 | 469 |
$rows = $dbi->select(table => $table1)->all; |
470 | 470 |
is_deeply($rows, [{$key1 => 1, $key2 => 2}], 'insert append'); |
471 | 471 |
|
472 |
-eval{$dbi->insert(table => $table1, noexist => 1)}; |
|
473 |
-like($@, qr/noexist/, "invalid"); |
|
474 |
- |
|
475 | 472 |
eval{$dbi->insert(table => 'table', param => {';' => 1})}; |
476 | 473 |
like($@, qr/safety/); |
477 | 474 |
|
... | ... |
@@ -626,9 +623,6 @@ is_deeply($rows, [{$key1 => 1, $key2 => 22, $key3 => 3, $key4 => 4, $key5 => 5}, |
626 | 623 |
|
627 | 624 |
$result = $dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1}, append => ' '); |
628 | 625 |
|
629 |
-eval{$dbi->update(table => $table1, where => {$key1 => 1}, noexist => 1)}; |
|
630 |
-like($@, qr/noexist/, "invalid"); |
|
631 |
- |
|
632 | 626 |
eval{$dbi->update(table => $table1)}; |
633 | 627 |
like($@, qr/where/, "not contain where"); |
634 | 628 |
|
... | ... |
@@ -805,9 +799,6 @@ $dbi->delete(table => $table1, where => {$key1 => 1, $key2 => 2}); |
805 | 799 |
$rows = $dbi->select(table => $table1)->all; |
806 | 800 |
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "delete multi key"); |
807 | 801 |
|
808 |
-eval{$dbi->delete(table => $table1, where => {$key1 => 1}, noexist => 1)}; |
|
809 |
-like($@, qr/noexist/, "invalid"); |
|
810 |
- |
|
811 | 802 |
eval { $dbi->execute("drop table $table1") }; |
812 | 803 |
$dbi->execute($create_table1); |
813 | 804 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}); |
... | ... |
@@ -914,9 +905,6 @@ $rows = $dbi->select( |
914 | 905 |
)->all; |
915 | 906 |
is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : no exists where"); |
916 | 907 |
|
917 |
-eval{$dbi->select(table => $table1, noexist => 1)}; |
|
918 |
-like($@, qr/noexist/, "invalid"); |
|
919 |
- |
|
920 | 908 |
$dbi = DBIx::Custom->connect; |
921 | 909 |
eval { $dbi->execute("drop table ${q}table$p") }; |
922 | 910 |
$dbi->execute($create_table_reserved); |
... | ... |
@@ -991,9 +979,6 @@ $dbi->execute($create_table1); |
991 | 979 |
like($@, qr/Custom.*\.t /s, "fail : verbose"); |
992 | 980 |
} |
993 | 981 |
|
994 |
-eval{$dbi->execute('select * from $table1', no_exists => 1)}; |
|
995 |
-like($@, qr/wrong/, "invald SQL"); |
|
996 |
- |
|
997 | 982 |
$query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1); |
998 | 983 |
$dbi->dbh->disconnect; |
999 | 984 |
eval{$dbi->execute($query, param => {$key1 => {a => 1}})}; |
... | ... |
@@ -1075,13 +1060,10 @@ $dbi->execute($create_table1); |
1075 | 1060 |
} |
1076 | 1061 |
{ |
1077 | 1062 |
local $Carp::Verbose = 1; |
1078 |
- eval{$dbi->execute('select * frm $table1')}; |
|
1063 |
+ eval{$dbi->execute("select * frm $table1")}; |
|
1079 | 1064 |
like($@, qr/Custom.*\.t /s, "fail : verbose"); |
1080 | 1065 |
} |
1081 | 1066 |
|
1082 |
-eval{$dbi->execute('select * from $table1', no_exists => 1)}; |
|
1083 |
-like($@, qr/wrong/, "invald SQL"); |
|
1084 |
- |
|
1085 | 1067 |
$query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1); |
1086 | 1068 |
$dbi->dbh->disconnect; |
1087 | 1069 |
eval{$dbi->execute($query, param => {$key1 => {a => 1}})}; |