- removed EXPERIMENTAL the following methods from...
...DBIx::Custom::Where
| ... | ... |
@@ -1,6 +1,10 @@ |
| 1 | 1 |
0.1723 |
| 2 | 2 |
- removed EXPERIMENTAL call_dbi method from DBIx::Custom::Model |
| 3 | 3 |
- removed EXPERIMENTAL map_param method from DBIx::Custom |
| 4 |
+ - removed EXPERIMENTAL the following methods from DBIx::Custom::Where |
|
| 5 |
+ if, map |
|
| 6 |
+ - removed EXPERIMENTAL flag from the following DBIx::Custom::Model methods |
|
| 7 |
+ count, execute |
|
| 4 | 8 |
- removed EXPERIMENTAL flag from the following DBIx::Custom::Result mehotds |
| 5 | 9 |
filter_on, type_rule, type_rule_off, type_rule_on, type_rule1_off, |
| 6 | 10 |
type_rule1_on, type_rule2_off, type_rule2_on |
| ... | ... |
@@ -12,8 +16,7 @@ |
| 12 | 16 |
exclude_table, user_column_info, |
| 13 | 17 |
user_table_info, available_datatype, available_typename, |
| 14 | 18 |
assign_param, count, get_column_info, get_table_info |
| 15 |
- order, show_datatype, show_typename methods, type_rule, |
|
| 16 |
- mapper |
|
| 19 |
+ order, show_datatype, show_typename methods, show_tables, type_rule, |
|
| 17 | 20 |
- added EXPERIMENTAL update_timestamp method to DBIx::Custom |
| 18 | 21 |
- added EXPERIMENTAL insert_timestamp method to DBIx::Custom |
| 19 | 22 |
- removed EXPERIMENTAL timestamp attribute from DBIx::Custom |
| ... | ... |
@@ -2876,7 +2876,7 @@ See L<DBIx::Custom::Model> to know model features. |
| 2876 | 2876 |
Parameter for timestamp columns when C<insert> method is executed |
| 2877 | 2877 |
with C<timestamp> option. |
| 2878 | 2878 |
|
| 2879 |
-=head2 C<mapper> |
|
| 2879 |
+=head2 C<mapper EXPERIMENTAL> |
|
| 2880 | 2880 |
|
| 2881 | 2881 |
my $mapper = $dbi->mapper(param => $param); |
| 2882 | 2882 |
|
| ... | ... |
@@ -3429,7 +3429,7 @@ Show data type of the columns of specified table. |
| 3429 | 3429 |
|
| 3430 | 3430 |
This data type is used in C<type_rule>'s C<from1> and C<from2>. |
| 3431 | 3431 |
|
| 3432 |
-=head2 C<show_tables EXPERIMETNAL> |
|
| 3432 |
+=head2 C<show_tables> |
|
| 3433 | 3433 |
|
| 3434 | 3434 |
$dbi->show_tables; |
| 3435 | 3435 |
|
| ... | ... |
@@ -39,11 +39,11 @@ C<Microsoft SQL Server>, C<Microsoft Access>, C<DB2> or anything, |
| 39 | 39 |
|
| 40 | 40 |
=item * |
| 41 | 41 |
|
| 42 |
-Filtering by data type or column name(EXPERIMENTAL) |
|
| 42 |
+Filtering by data type or column name |
|
| 43 | 43 |
|
| 44 | 44 |
=item * |
| 45 | 45 |
|
| 46 |
-Create C<order by> clause flexibly(EXPERIMENTAL) |
|
| 46 |
+Create C<order by> clause flexibly |
|
| 47 | 47 |
|
| 48 | 48 |
=back |
| 49 | 49 |
|
| ... | ... |
@@ -62,8 +62,15 @@ foreach my $method (@methods) {
|
| 62 | 62 |
|
| 63 | 63 |
sub execute {
|
| 64 | 64 |
my $self = shift; |
| 65 |
- push @_, ($_ => $self->$_) for qw/table bind_type primary_key type/; |
|
| 66 |
- return $self->dbi->execute(@_); |
|
| 65 |
+ return $self->dbi->execute( |
|
| 66 |
+ shift, |
|
| 67 |
+ shift, |
|
| 68 |
+ table => $self->table, |
|
| 69 |
+ bind_type => $self->bind_type, |
|
| 70 |
+ primary_key => $self->primary_key, |
|
| 71 |
+ type => $self->type, |
|
| 72 |
+ @_ |
|
| 73 |
+ ); |
|
| 67 | 74 |
} |
| 68 | 75 |
|
| 69 | 76 |
sub DESTROY { }
|
| ... | ... |
@@ -167,22 +174,7 @@ L<DBIx::Custom::Model> inherits all methods from L<Object::Simple>, |
| 167 | 174 |
and you can use all methods of L<DBIx::Custom> and L<DBI> |
| 168 | 175 |
and implements the following new ones. |
| 169 | 176 |
|
| 170 |
-=head2 C<call_dbi> EXPERIMENTAL |
|
| 171 |
- |
|
| 172 |
- $model->call_dbi('insert',
|
|
| 173 |
- {args => ['table', 'primary_key' 'bind_type']}, @_)
|
|
| 174 |
- |
|
| 175 |
-Call L<DBIx::Custom>(or subclass) method. you can add |
|
| 176 |
-attribute values of model to arguments by C<args> option. |
|
| 177 |
- |
|
| 178 |
-Generally this method is used when you want to added dbi method to model. |
|
| 179 |
- |
|
| 180 |
- sub insert {
|
|
| 181 |
- shift->call_dbi('insert',
|
|
| 182 |
- {args => ['table', 'primary_key' 'bind_type']}, @_);
|
|
| 183 |
- } |
|
| 184 |
- |
|
| 185 |
-=head2 C<count> EXPERIMENTAL |
|
| 177 |
+=head2 C<count> |
|
| 186 | 178 |
|
| 187 | 179 |
my $count = $model->count; |
| 188 | 180 |
|
| ... | ... |
@@ -204,7 +196,7 @@ you don't have to specify C<table> and C<primary_key> option. |
| 204 | 196 |
Same as C<delete_all> of L<DBIx::Custom> except that |
| 205 | 197 |
you don't have to specify C<table> and C<primary_key> option. |
| 206 | 198 |
|
| 207 |
-=head2 C<execute EXPERIMENTAL> |
|
| 199 |
+=head2 C<execute> |
|
| 208 | 200 |
|
| 209 | 201 |
$model->execute(...); |
| 210 | 202 |
|
| ... | ... |
@@ -12,114 +12,6 @@ push @DBIx::Custom::CARP_NOT, __PACKAGE__; |
| 12 | 12 |
has [qw/dbi param/], |
| 13 | 13 |
clause => sub { [] };
|
| 14 | 14 |
|
| 15 |
-sub map {
|
|
| 16 |
- my ($self, %map) = @_; |
|
| 17 |
- |
|
| 18 |
- if ($self->if ne 'exists' || keys %map) {
|
|
| 19 |
- my $param = $self->_map_param($self->param, %map); |
|
| 20 |
- $self->param($param); |
|
| 21 |
- } |
|
| 22 |
- return $self; |
|
| 23 |
-} |
|
| 24 |
- |
|
| 25 |
-sub _map_param {
|
|
| 26 |
- my $self = shift; |
|
| 27 |
- my $param = shift; |
|
| 28 |
- |
|
| 29 |
- return $param if !defined $param; |
|
| 30 |
- |
|
| 31 |
- my %map = @_; |
|
| 32 |
- |
|
| 33 |
- # Mapping |
|
| 34 |
- my $map_param = {};
|
|
| 35 |
- foreach my $key (keys %$param) {
|
|
| 36 |
- |
|
| 37 |
- my $value_cb; |
|
| 38 |
- my $condition; |
|
| 39 |
- my $map_key; |
|
| 40 |
- |
|
| 41 |
- # Get mapping information |
|
| 42 |
- if (ref $map{$key} eq 'ARRAY') {
|
|
| 43 |
- foreach my $some (@{$map{$key}}) {
|
|
| 44 |
- $map_key = $some unless ref $some; |
|
| 45 |
- $condition = $some->{if} if ref $some eq 'HASH';
|
|
| 46 |
- $value_cb = $some if ref $some eq 'CODE'; |
|
| 47 |
- } |
|
| 48 |
- } |
|
| 49 |
- elsif (defined $map{$key}) {
|
|
| 50 |
- $map_key = $map{$key};
|
|
| 51 |
- } |
|
| 52 |
- else {
|
|
| 53 |
- $map_key = $key; |
|
| 54 |
- } |
|
| 55 |
- |
|
| 56 |
- $value_cb ||= sub { $_[0] };
|
|
| 57 |
- $condition ||= $self->if || 'exists'; |
|
| 58 |
- $condition = $self->_if_to_sub($condition); |
|
| 59 |
- |
|
| 60 |
- # Map parameter |
|
| 61 |
- my $value; |
|
| 62 |
- if (ref $condition eq 'CODE') {
|
|
| 63 |
- if (ref $param->{$key} eq 'ARRAY') {
|
|
| 64 |
- $map_param->{$map_key} = [];
|
|
| 65 |
- for (my $i = 0; $i < @{$param->{$key}}; $i++) {
|
|
| 66 |
- $map_param->{$map_key}->[$i]
|
|
| 67 |
- = $condition->($param->{$key}->[$i]) ? $param->{$key}->[$i]
|
|
| 68 |
- : $self->dbi->not_exists; |
|
| 69 |
- } |
|
| 70 |
- } |
|
| 71 |
- else {
|
|
| 72 |
- $map_param->{$map_key} = $value_cb->($param->{$key})
|
|
| 73 |
- if $condition->($param->{$key});
|
|
| 74 |
- } |
|
| 75 |
- } |
|
| 76 |
- elsif ($condition eq 'exists') {
|
|
| 77 |
- if (ref $param->{$key} eq 'ARRAY') {
|
|
| 78 |
- $map_param->{$map_key} = [];
|
|
| 79 |
- for (my $i = 0; $i < @{$param->{$key}}; $i++) {
|
|
| 80 |
- $map_param->{$map_key}->[$i]
|
|
| 81 |
- = exists $param->{$key}->[$i] ? $param->{$key}->[$i]
|
|
| 82 |
- : $self->dbi->not_exists; |
|
| 83 |
- } |
|
| 84 |
- } |
|
| 85 |
- else {
|
|
| 86 |
- $map_param->{$map_key} = $value_cb->($param->{$key})
|
|
| 87 |
- if exists $param->{$key};
|
|
| 88 |
- } |
|
| 89 |
- } |
|
| 90 |
- else { croak qq/Condition must be code reference or "exists" / . _subname }
|
|
| 91 |
- } |
|
| 92 |
- |
|
| 93 |
- return $map_param; |
|
| 94 |
-} |
|
| 95 |
- |
|
| 96 |
-sub if {
|
|
| 97 |
- my $self = shift; |
|
| 98 |
- if (@_) {
|
|
| 99 |
- my $if = $_[0]; |
|
| 100 |
- |
|
| 101 |
- $if = $self->_if_to_sub($if); |
|
| 102 |
- $self->{if} = $if;
|
|
| 103 |
- return $self; |
|
| 104 |
- } |
|
| 105 |
- $self->{if} = 'exists' unless exists $self->{if};
|
|
| 106 |
- return $self->{if};
|
|
| 107 |
-} |
|
| 108 |
- |
|
| 109 |
-sub _if_to_sub {
|
|
| 110 |
- my ($self, $if) = @_; |
|
| 111 |
- $if = $if eq 'exists' ? $if |
|
| 112 |
- : $if eq 'defined' ? sub { defined $_[0] }
|
|
| 113 |
- : $if eq 'length' ? sub { defined $_[0] && length $_[0] }
|
|
| 114 |
- : ref $if eq 'CODE' ? $if |
|
| 115 |
- : undef; |
|
| 116 |
- |
|
| 117 |
- croak "You can must specify right value to C<if> " . _subname |
|
| 118 |
- unless $if; |
|
| 119 |
- |
|
| 120 |
- return $if; |
|
| 121 |
-} |
|
| 122 |
- |
|
| 123 | 15 |
sub new {
|
| 124 | 16 |
my $self = shift->SUPER::new(@_); |
| 125 | 17 |
|
| ... | ... |
@@ -149,18 +41,6 @@ sub to_string {
|
| 149 | 41 |
$clause = ['and', $clause] unless ref $clause eq 'ARRAY'; |
| 150 | 42 |
$clause->[0] = 'and' unless @$clause; |
| 151 | 43 |
|
| 152 |
- # Map condition |
|
| 153 |
- my $if = $self->if || ''; |
|
| 154 |
- $if = $if eq 'exists' ? $if |
|
| 155 |
- : $if eq 'defined' ? sub { defined $_[0] }
|
|
| 156 |
- : $if eq 'length' ? sub { length $_[0] }
|
|
| 157 |
- : ref $if eq 'CODE' ? $if |
|
| 158 |
- : undef; |
|
| 159 |
- |
|
| 160 |
- croak "You can must specify right value to C<if> " . _subname |
|
| 161 |
- unless $if; |
|
| 162 |
- $self->{_if} = $if;
|
|
| 163 |
- |
|
| 164 | 44 |
# Parse |
| 165 | 45 |
my $where = []; |
| 166 | 46 |
my $count = {};
|
| ... | ... |
@@ -314,69 +194,6 @@ L<DBIx::Custom> object. |
| 314 | 194 |
L<DBIx::Custom::Where> inherits all methods from L<Object::Simple> |
| 315 | 195 |
and implements the following new ones. |
| 316 | 196 |
|
| 317 |
-=head2 C<if EXPERIMENTAL> |
|
| 318 |
- |
|
| 319 |
- my $if = $where->if($condition); |
|
| 320 |
- $where->if($condition); |
|
| 321 |
- |
|
| 322 |
-C<if> is default of C<map> method C<if> option. |
|
| 323 |
- |
|
| 324 |
-=head2 C<map EXPERIMENTAL> |
|
| 325 |
- |
|
| 326 |
-Mapping parameter key and value. C<param> is converted based on, |
|
| 327 |
-so this method must be called after C<param> is set. |
|
| 328 |
-Set C<if> if you need before C<map> method call. |
|
| 329 |
- |
|
| 330 |
- $where->map( |
|
| 331 |
- 'id' => 'book.id', |
|
| 332 |
- 'author' => ['book.author' => sub { '%' . $_[0] . '%' }],
|
|
| 333 |
- 'price' => [ |
|
| 334 |
- 'book.price', {if => sub { length $_[0] }
|
|
| 335 |
- ] |
|
| 336 |
- ); |
|
| 337 |
- |
|
| 338 |
-The followin parameter |
|
| 339 |
- |
|
| 340 |
- {
|
|
| 341 |
- id => 1, |
|
| 342 |
- auhtor => 'Ken', |
|
| 343 |
- price => 1000 |
|
| 344 |
- } |
|
| 345 |
- |
|
| 346 |
-is converted to |
|
| 347 |
- |
|
| 348 |
- {
|
|
| 349 |
- 'book.id' => 1, |
|
| 350 |
- 'book.author' => '%Ken%', |
|
| 351 |
- 'book.price' => 1000 |
|
| 352 |
- } |
|
| 353 |
- |
|
| 354 |
-The following option is available. |
|
| 355 |
- |
|
| 356 |
-=over 4 |
|
| 357 |
- |
|
| 358 |
-=item * C<if> |
|
| 359 |
- |
|
| 360 |
-By default, if parameter key is exists, mapping is done. |
|
| 361 |
- |
|
| 362 |
- if => 'exists'; |
|
| 363 |
- |
|
| 364 |
-In case C<defined> is specified, if the value is defined, |
|
| 365 |
-mapping is done. |
|
| 366 |
- |
|
| 367 |
- if => 'defined'; |
|
| 368 |
- |
|
| 369 |
-In case C<length> is specified, the value is defined |
|
| 370 |
-and the length is bigger than 0, mappting is done. |
|
| 371 |
- |
|
| 372 |
- if => 'length'; |
|
| 373 |
- |
|
| 374 |
-You can also subroutine like C<sub { defined $_[0] }> for mappging.
|
|
| 375 |
- |
|
| 376 |
- if => sub { defined $_[0] }
|
|
| 377 |
- |
|
| 378 |
-=back |
|
| 379 |
- |
|
| 380 | 197 |
=head2 C<to_string> |
| 381 | 198 |
|
| 382 | 199 |
$where->to_string; |
| ... | ... |
@@ -1609,15 +1609,6 @@ $result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
| 1609 | 1609 |
$row = $result->all; |
| 1610 | 1610 |
is_deeply($row, [{$key1 => 1, $key2 => 2}]);
|
| 1611 | 1611 |
|
| 1612 |
-$where = $dbi->where; |
|
| 1613 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1614 |
-$where->param({$key1 => undef});
|
|
| 1615 |
-$where->if('defined');
|
|
| 1616 |
-$where->map; |
|
| 1617 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
|
| 1618 |
-$row = $result->all; |
|
| 1619 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
|
|
| 1620 |
- |
|
| 1621 | 1612 |
$where = $dbi->where; |
| 1622 | 1613 |
$where->clause(['or', ":${key1}{=}", ":${key1}{=}"]);
|
| 1623 | 1614 |
$where->param({$key1 => [undef, undef]});
|
| ... | ... |
@@ -1628,133 +1619,6 @@ $result = $dbi->execute("select * from $table1 $where", {$key1 => [0, 1]});
|
| 1628 | 1619 |
$row = $result->all; |
| 1629 | 1620 |
is_deeply($row, [{$key1 => 1, $key2 => 2}]);
|
| 1630 | 1621 |
|
| 1631 |
-$where = $dbi->where; |
|
| 1632 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1633 |
-$where->param({$key1 => [undef, undef]});
|
|
| 1634 |
-$where->if('defined');
|
|
| 1635 |
-$where->map; |
|
| 1636 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => [1, 0]});
|
|
| 1637 |
-$row = $result->all; |
|
| 1638 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
|
|
| 1639 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => [0, 1]});
|
|
| 1640 |
-$row = $result->all; |
|
| 1641 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
|
|
| 1642 |
- |
|
| 1643 |
-$where = $dbi->where; |
|
| 1644 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1645 |
-$where->param({$key1 => 0});
|
|
| 1646 |
-$where->if('length');
|
|
| 1647 |
-$where->map; |
|
| 1648 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
|
| 1649 |
-$row = $result->all; |
|
| 1650 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}]);
|
|
| 1651 |
- |
|
| 1652 |
-$where = $dbi->where; |
|
| 1653 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1654 |
-$where->param({$key1 => ''});
|
|
| 1655 |
-$where->if('length');
|
|
| 1656 |
-$where->map; |
|
| 1657 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
|
| 1658 |
-$row = $result->all; |
|
| 1659 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
|
|
| 1660 |
- |
|
| 1661 |
-$where = $dbi->where; |
|
| 1662 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1663 |
-$where->param({$key1 => 5});
|
|
| 1664 |
-$where->if(sub { ($_[0] || '') eq 5 });
|
|
| 1665 |
-$where->map; |
|
| 1666 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
|
| 1667 |
-$row = $result->all; |
|
| 1668 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}]);
|
|
| 1669 |
- |
|
| 1670 |
-$where = $dbi->where; |
|
| 1671 |
-$where->clause(['and', ":${key1}{=}"]);
|
|
| 1672 |
-$where->param({$key1 => 7});
|
|
| 1673 |
-$where->if(sub { ($_[0] || '') eq 5 });
|
|
| 1674 |
-$where->map; |
|
| 1675 |
-$result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
|
|
| 1676 |
-$row = $result->all; |
|
| 1677 |
-is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
|
|
| 1678 |
- |
|
| 1679 |
-$where = $dbi->where; |
|
| 1680 |
-$where->param({id => 1, author => 'Ken', price => 1900});
|
|
| 1681 |
-$where->map(id => "$table1.id", |
|
| 1682 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }],
|
|
| 1683 |
- price => ["$table1.price", {if => sub { $_[0] eq 1900 }}]
|
|
| 1684 |
-); |
|
| 1685 |
-is_deeply($where->param, {"$table1.id" => 1, "$table1.author" => '%Ken%',
|
|
| 1686 |
- "$table1.price" => 1900}); |
|
| 1687 |
- |
|
| 1688 |
-$where = $dbi->where; |
|
| 1689 |
-$where->param({id => 0, author => 0, price => 0});
|
|
| 1690 |
-$where->map( |
|
| 1691 |
- id => "$table1.id", |
|
| 1692 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }],
|
|
| 1693 |
- price => ["$table1.price", sub { '%' . $_[0] . '%' },
|
|
| 1694 |
- {if => sub { $_[0] eq 0 }}]
|
|
| 1695 |
-); |
|
| 1696 |
-is_deeply($where->param, {"$table1.id" => 0, "$table1.author" => '%0%', "$table1.price" => '%0%'});
|
|
| 1697 |
- |
|
| 1698 |
-$where = $dbi->where; |
|
| 1699 |
-$where->param({id => '', author => '', price => ''});
|
|
| 1700 |
-$where->if('length');
|
|
| 1701 |
-$where->map( |
|
| 1702 |
- id => "$table1.id", |
|
| 1703 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }],
|
|
| 1704 |
- price => ["$table1.price", sub { '%' . $_[0] . '%' },
|
|
| 1705 |
- {if => sub { $_[0] eq 1 }}]
|
|
| 1706 |
-); |
|
| 1707 |
-is_deeply($where->param, {});
|
|
| 1708 |
- |
|
| 1709 |
-$where = $dbi->where; |
|
| 1710 |
-$where->param({id => undef, author => undef, price => undef});
|
|
| 1711 |
-$where->if('length');
|
|
| 1712 |
-$where->map( |
|
| 1713 |
- id => "$table1.id", |
|
| 1714 |
- price => ["$table1.price", {if => 'exists'}]
|
|
| 1715 |
-); |
|
| 1716 |
-is_deeply($where->param, {"$table1.price" => undef});
|
|
| 1717 |
- |
|
| 1718 |
-$where = $dbi->where; |
|
| 1719 |
-$where->param({price => 'a'});
|
|
| 1720 |
-$where->if('length');
|
|
| 1721 |
-$where->map( |
|
| 1722 |
- id => ["$table1.id", {if => 'exists'}],
|
|
| 1723 |
- price => ["$table1.price", sub { '%' . $_[0] }, {if => 'exists'}]
|
|
| 1724 |
-); |
|
| 1725 |
-is_deeply($where->param, {"$table1.price" => '%a'});
|
|
| 1726 |
- |
|
| 1727 |
-$where = $dbi->where; |
|
| 1728 |
-$where->param({id => [1, 2], author => 'Ken', price => 1900});
|
|
| 1729 |
-$where->map( |
|
| 1730 |
- id => "$table1.id", |
|
| 1731 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }],
|
|
| 1732 |
- price => ["$table1.price", {if => sub { $_[0] eq 1900 }}]
|
|
| 1733 |
-); |
|
| 1734 |
-is_deeply($where->param, {"$table1.id" => [1, 2], "$table1.author" => '%Ken%',
|
|
| 1735 |
- "$table1.price" => 1900}); |
|
| 1736 |
- |
|
| 1737 |
-$where = $dbi->where; |
|
| 1738 |
-$where->if('length');
|
|
| 1739 |
-$where->param({id => ['', ''], author => 'Ken', price => 1900});
|
|
| 1740 |
-$where->map( |
|
| 1741 |
- id => "$table1.id", |
|
| 1742 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }],
|
|
| 1743 |
- price => ["$table1.price", {if => sub { $_[0] eq 1900 }}]
|
|
| 1744 |
-); |
|
| 1745 |
-is_deeply($where->param, {"$table1.id" => [$dbi->not_exists, $dbi->not_exists], "$table1.author" => '%Ken%',
|
|
| 1746 |
- "$table1.price" => 1900}); |
|
| 1747 |
- |
|
| 1748 |
-$where = $dbi->where; |
|
| 1749 |
-$where->param({id => ['', ''], author => 'Ken', price => 1900});
|
|
| 1750 |
-$where->map( |
|
| 1751 |
- id => ["$table1.id", {if => 'length'}],
|
|
| 1752 |
- author => ["$table1.author", sub { '%' . $_[0] . '%' }, {if => 'defined'}],
|
|
| 1753 |
- price => ["$table1.price", {if => sub { $_[0] eq 1900 }}]
|
|
| 1754 |
-); |
|
| 1755 |
-is_deeply($where->param, {"$table1.id" => [$dbi->not_exists, $dbi->not_exists], "$table1.author" => '%Ken%',
|
|
| 1756 |
- "$table1.price" => 1900}); |
|
| 1757 |
- |
|
| 1758 | 1622 |
test 'register_tag_processor'; |
| 1759 | 1623 |
$dbi = DBIx::Custom->connect; |
| 1760 | 1624 |
$dbi->register_tag_processor( |