Showing 1 changed files with 14 additions and 14 deletions
+14 -14
lib/DBI/Custom.pm
... ...
@@ -238,8 +238,8 @@ sub _build_bind_values {
238 238
                     if (ref $key eq 'ARRAY') {
239 239
                         if ($bind_filter && !$no_bind_filters_map->{$original_key}) {
240 240
                             push @bind_values, 
241
-                                 $bind_filter->($root_params->[$key->[0]],
242
-                                                $original_key, $table, $column);
241
+                                 $bind_filter->($original_key, $root_params->[$key->[0]],
242
+                                                $table, $column);
243 243
                         }
244 244
                         else {
245 245
                             push @bind_values, scalar $root_params->[$key->[0]];
... ...
@@ -249,8 +249,8 @@ sub _build_bind_values {
249 249
                         next ACCESS_KEYS unless exists $root_params->{$key};
250 250
                         if ($bind_filter && !$no_bind_filters_map->{$original_key}) {
251 251
                             push @bind_values,
252
-                                 $bind_filter->($root_params->{$key}, 
253
-                                                $original_key, $table, $column);
252
+                                 $bind_filter->($original_key, $root_params->{$key}, 
253
+                                                $table, $column);
254 254
                         }
255 255
                         else {
256 256
                             push @bind_values, scalar $root_params->{$key};
... ...
@@ -444,38 +444,38 @@ If database is already disconnected, this method do noting.
444 444
     # Sample
445 445
     $dbi->add_filter(
446 446
         decode_utf8 => sub {
447
-            my $value = shift;
447
+            my ($key, $value, $table, $column) = @_;
448 448
             return Encode::decode('UTF-8', $value);
449 449
         },
450 450
         datetime_to_string => sub {
451
-            my $value = shift;
451
+            my ($key, $value, $table, $column) = @_;
452 452
             return $value->strftime('%Y-%m-%d %H:%M:%S')
453 453
         },
454 454
         default_bind_filter => sub {
455
-            my ($value, $key, $filters) = @_;
455
+            my ($key, $value, $table, $column) = @_;
456 456
             if (ref $value eq 'Time::Piece') {
457
-                return $filters->{datetime_to_string}->($value);
457
+                return $dbi->filters->{datetime_to_string}->($value);
458 458
             }
459 459
             else {
460
-                return $filters->{decode_utf8}->($value);
460
+                return $dbi->filters->{decode_utf8}->($value);
461 461
             }
462 462
         },
463 463
         
464 464
         encode_utf8 => sub {
465
-            my $value = shift;
465
+            my ($key, $value) = @_;
466 466
             return Encode::encode('UTF-8', $value);
467 467
         },
468 468
         string_to_datetime => sub {
469
-            my $value = shift;
469
+            my ($key, $value) = @_;
470 470
             return DateTime::Format::MySQL->parse_datetime($value);
471 471
         },
472 472
         default_fetch_filter => sub {
473
-            my ($value, $key, $filters, $type, $sth, $i) = @_;
473
+            my ($key, $value, $type, $sth, $i) = @_;
474 474
             if ($type eq 'DATETIME') {
475
-                return $self->filters->{string_to_datetime}->($value);
475
+                return $dbi->filters->{string_to_datetime}->($value);
476 476
             }
477 477
             else {
478
-                return $self->filters->{encode_utf8}->($value);
478
+                return $dbi->filters->{encode_utf8}->($value);
479 479
             }
480 480
         }
481 481
     );