| ... | ... |
@@ -25,16 +25,6 @@ sub _map_param {
|
| 25 | 25 |
my $map_param = {};
|
| 26 | 26 |
foreach my $key (keys %$param) {
|
| 27 | 27 |
|
| 28 |
- unless (exists $map{$key}) {
|
|
| 29 |
- if (ref $param->{$key} eq 'ARRAY') {
|
|
| 30 |
- $map_param->{$key} = [@{$param->{$key}}];
|
|
| 31 |
- } |
|
| 32 |
- else {
|
|
| 33 |
- $map_param->{$key} = $param->{$key};
|
|
| 34 |
- } |
|
| 35 |
- next; |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 | 28 |
my $value_cb; |
| 39 | 29 |
my $condition; |
| 40 | 30 |
my $map_key; |
| ... | ... |
@@ -47,9 +37,13 @@ sub _map_param {
|
| 47 | 37 |
$value_cb = $some if ref $some eq 'CODE'; |
| 48 | 38 |
} |
| 49 | 39 |
} |
| 50 |
- else {
|
|
| 40 |
+ elsif (defined $map{$key}) {
|
|
| 51 | 41 |
$map_key = $map{$key};
|
| 52 | 42 |
} |
| 43 |
+ else {
|
|
| 44 |
+ $map_key = $key; |
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 53 | 47 |
$value_cb ||= sub { $_[0] };
|
| 54 | 48 |
$condition ||= $self->if || 'exists'; |
| 55 | 49 |
|
| ... | ... |
@@ -238,23 +232,10 @@ sub _parse {
|
| 238 | 232 |
my $if = $self->{_if};
|
| 239 | 233 |
|
| 240 | 234 |
if (ref $param->{$column} eq 'ARRAY') {
|
| 241 |
- unless (ref $param->{$column}->[$count - 1] eq 'DBIx::Custom::NotExists') {
|
|
| 242 |
- if ($if eq 'exists') {
|
|
| 243 |
- $pushed = 1 if exists $param->{$column}->[$count - 1];
|
|
| 244 |
- } |
|
| 245 |
- else {
|
|
| 246 |
- $pushed = 1 if $if->($param->{$column}->[$count - 1]);
|
|
| 247 |
- } |
|
| 248 |
- } |
|
| 249 |
- } |
|
| 250 |
- elsif ($count == 1) {
|
|
| 251 |
- if ($if eq 'exists') {
|
|
| 252 |
- $pushed = 1 if exists $param->{$column};
|
|
| 253 |
- } |
|
| 254 |
- else {
|
|
| 255 |
- $pushed = 1 if $if->($param->{$column});
|
|
| 256 |
- } |
|
| 235 |
+ $pushed = 1 if exists $param->{$column}->[$count - 1]
|
|
| 236 |
+ && ref $param->{$column}->[$count - 1] ne 'DBIx::Custom::NotExists'
|
|
| 257 | 237 |
} |
| 238 |
+ elsif ($count == 1) { $pushed = 1 }
|
|
| 258 | 239 |
} |
| 259 | 240 |
push @$where, $clause if $pushed; |
| 260 | 241 |
} |