Showing 5 changed files with 177 additions and 316 deletions
+2
Changes
... ...
@@ -1,3 +1,5 @@
1
+0.1629
2
+  deprecated cache_method
1 3
 0.1628
2 4
   remove DBIx::Custom::Model
3 5
   move table method and table_class attribute to DBIx::Custom
+145 -150
lib/DBIx/Custom.pm
... ...
@@ -20,21 +20,6 @@ __PACKAGE__->attr([qw/data_source dbh
20 20
                       dbi_options password user/]);
21 21
 
22 22
 __PACKAGE__->attr(cache => 1);
23
-__PACKAGE__->attr(cache_method => sub {
24
-    sub {
25
-        my $self = shift;
26
-        
27
-        $self->{_cached} ||= {};
28
-        
29
-        if (@_ > 1) {
30
-            $self->{_cached}{$_[0]} = $_[1] 
31
-        }
32
-        else {
33
-            return $self->{_cached}{$_[0]}
34
-        }
35
-    }
36
-});
37
-
38 23
 __PACKAGE__->attr(filters => sub {
39 24
     {
40 25
         encode_utf8 => sub { encode_utf8($_[0]) },
... ...
@@ -89,51 +74,51 @@ sub auto_filter {
89 74
         my @cs = @_;
90 75
         
91 76
         # Initialize filters
92
-        $self->{auto_filter}{bind} ||= {};
93
-        $self->{auto_filter}{fetch} ||= {};
77
+        $self->{auto_filter}{out} ||= {};
78
+        $self->{auto_filter}{in} ||= {};
94 79
         
95 80
         # Create auto filters
96 81
         foreach my $c (@cs) {
97 82
             croak "Usage \$dbi->auto_filter(" .
98
-                  "TABLE, [COLUMN, BIND_FILTER, FETCH_FILTER], [...])"
83
+                  "TABLE, [COLUMN, OUT_FILTER, IN_FILTER], [...])"
99 84
               unless ref $c eq 'ARRAY' && @$c == 3;
100 85
             
101 86
             # Column
102 87
             my $column = $c->[0];
103 88
             
104 89
             # Bind filter
105
-            my $bind_filter  = $c->[1];
106
-            if (ref $bind_filter eq 'CODE') {
107
-    	        $self->{auto_filter}{bind}{$table}{$column}
108
-    	          = $bind_filter;
109
-    	        $self->{auto_filter}{bind}{$table}{"$table.$column"}
110
-    	          = $bind_filter;
90
+            my $out_filter  = $c->[1];
91
+            if (ref $out_filter eq 'CODE') {
92
+    	        $self->{auto_filter}{out}{$table}{$column}
93
+    	          = $out_filter;
94
+    	        $self->{auto_filter}{out}{$table}{"$table.$column"}
95
+    	          = $out_filter;
111 96
             }
112 97
             else {
113
-    	        croak qq{"$bind_filter" is not registered}
114
-    	          unless exists $self->filters->{$bind_filter};
98
+    	        croak qq{"$out_filter" is not registered}
99
+    	          unless exists $self->filters->{$out_filter};
115 100
     	        
116
-    	        $self->{auto_filter}{bind}{$table}{$column}
117
-    	          = $self->filters->{$bind_filter};
118
-    	        $self->{auto_filter}{bind}{$table}{"$table.$column"}
119
-    	          = $self->filters->{$bind_filter};
101
+    	        $self->{auto_filter}{out}{$table}{$column}
102
+    	          = $self->filters->{$out_filter};
103
+    	        $self->{auto_filter}{out}{$table}{"$table.$column"}
104
+    	          = $self->filters->{$out_filter};
120 105
     	    }
121 106
             
122 107
             # Fetch filter
123
-            my $fetch_filter = $c->[2];
124
-            if (ref $fetch_filter eq 'CODE') {
125
-    	        $self->{auto_filter}{fetch}{$table}{$column}
126
-    	          = $fetch_filter;
127
-    	        $self->{auto_filter}{fetch}{$table}{"$table.$column"}
128
-    	          = $fetch_filter;
108
+            my $in_filter = $c->[2];
109
+            if (ref $in_filter eq 'CODE') {
110
+    	        $self->{auto_filter}{in}{$table}{$column}
111
+    	          = $in_filter;
112
+    	        $self->{auto_filter}{in}{$table}{"$table.$column"}
113
+    	          = $in_filter;
129 114
             }
130 115
             else {
131
-                croak qq{"$fetch_filter" is not registered}
132
-                  unless exists $self->filters->{$fetch_filter};
133
-                $self->{auto_filter}{fetch}{$table}{$column}
134
-                  = $self->filters->{$fetch_filter};
135
-                $self->{auto_filter}{fetch}{$table}{"$table.$column"}
136
-                  = $self->filters->{$fetch_filter};
116
+                croak qq{"$in_filter" is not registered}
117
+                  unless exists $self->filters->{$in_filter};
118
+                $self->{auto_filter}{in}{$table}{$column}
119
+                  = $self->filters->{$in_filter};
120
+                $self->{auto_filter}{in}{$table}{"$table.$column"}
121
+                  = $self->filters->{$in_filter};
137 122
             }
138 123
         }
139 124
         
... ...
@@ -252,48 +237,6 @@ sub create_query {
252 237
     return $query;
253 238
 }
254 239
 
255
-sub default_bind_filter {
256
-    my $self = shift;
257
-    
258
-    if (@_) {
259
-        my $fname = $_[0];
260
-        
261
-        if (@_ && !$fname) {
262
-            $self->{default_bind_filter} = undef;
263
-        }
264
-        else {
265
-            croak qq{"$fname" is not registered}
266
-              unless exists $self->filters->{$fname};
267
-        
268
-            $self->{default_bind_filter} = $self->filters->{$fname};
269
-        }
270
-        return $self;
271
-    }
272
-    
273
-    return $self->{default_bind_filter};
274
-}
275
-
276
-sub default_fetch_filter {
277
-    my $self = shift;
278
-    my $fname = $_[0];
279
-    
280
-    if (@_) {
281
-        if (@_ && !$fname) {
282
-            $self->{default_fetch_filter} = undef;
283
-        }
284
-        else {
285
-            croak qq{"$fname" is not registered}
286
-              unless exists $self->filters->{$fname};
287
-        
288
-            $self->{default_fetch_filter} = $self->filters->{$fname};
289
-        }
290
-        
291
-        return $self;
292
-    }
293
-    
294
-    return $self->{default_fetch_filter}
295
-}
296
-
297 240
 our %VALID_DELETE_ARGS
298 241
   = map { $_ => 1 } qw/auto_filter_table table where append filter allow_delete_all/;
299 242
 
... ...
@@ -373,7 +316,7 @@ sub execute{
373 316
     foreach my $table (@$auto_filter_tables) {
374 317
         $auto_filter = {
375 318
             %$auto_filter,
376
-            %{$self->{auto_filter}{bind}->{$table} || {}}
319
+            %{$self->{auto_filter}{in}->{$table} || {}}
377 320
         }
378 321
     }
379 322
     
... ...
@@ -390,34 +333,34 @@ sub execute{
390 333
     }
391 334
     $filter = {%$auto_filter, %$filter};
392 335
     
393
-    # Create bind value
394
-    my $bind_values = $self->_build_bind_values($query, $params, $filter);
336
+    # Create bind values
337
+    my $binds = $self->_build_binds($params, $query->columns, $filter);
395 338
     
396 339
     # Execute
397 340
     my $sth      = $query->sth;
398 341
     my $affected;
399
-    eval {$affected = $sth->execute(@$bind_values)};
342
+    eval {$affected = $sth->execute(@$binds)};
400 343
     $self->_croak($@) if $@;
401 344
     
402 345
     # Return resultset if select statement is executed
403 346
     if ($sth->{NUM_OF_FIELDS}) {
404 347
         
405
-        # Auto fetch filter
406
-        my $auto_fetch_filter = {};
407
-	    foreach my $table (@$auto_filter_tables) {
408
-	        $auto_fetch_filter = {
409
-	            %$auto_filter,
410
-	            %{$self->{auto_filter}{fetch}{$table} || {}}
411
-	        }
412
-	    }
348
+        # Auto in filter
349
+        my $auto_in_filter = {};
350
+	      foreach my $table (@$auto_filter_tables) {
351
+	          $auto_in_filter = {
352
+	              %$auto_filter,
353
+	              %{$self->{auto_filter}{in}{$table} || {}}
354
+	          }
355
+	      }
413 356
 	    
414 357
 		# Result
415 358
 		my $result = $self->result_class->new(
416 359
             sth            => $sth,
417 360
             filters        => $self->filters,
418 361
             filter_check   => $self->filter_check,
419
-            default_filter => $self->default_fetch_filter,
420
-            _auto_filter   => $auto_fetch_filter || {}
362
+            default_filter => $self->{default_in_filter},
363
+            _auto_filter   => $auto_in_filter || {}
421 364
         );
422 365
 
423 366
         return $result;
... ...
@@ -720,37 +663,31 @@ sub update {
720 663
 
721 664
 sub update_all { shift->update(allow_update_all => 1, @_) };
722 665
 
723
-sub _build_bind_values {
724
-    my ($self, $query, $params, $filter) = @_;
666
+sub _build_binds {
667
+    my ($self, $params, $columns, $filter) = @_;
725 668
     
726
-    # binding values
727
-    my @bind_values;
728
-
729
-    # Filter
730
-    $filter ||= {};
731
-    
732
-    # Parameter
733
-    $params ||= {};
669
+    # bind values
670
+    my @binds;
734 671
     
735 672
     # Build bind values
736 673
     my $count = {};
737
-    foreach my $column (@{$query->columns}) {
674
+    foreach my $column (@$columns) {
738 675
         
739 676
         # Value
740 677
         my $value = ref $params->{$column} eq 'ARRAY'
741 678
                   ? $params->{$column}->[$count->{$column} || 0]
742 679
                   : $params->{$column};
743 680
         
744
-        # Filtering
745
-        my $f = $filter->{$column} || $self->{default_bind_filter} || '';
681
+        # Filter
682
+        my $f = $filter->{$column} || $self->{default_out_filter} || '';
746 683
         
747
-        push @bind_values, $f ? $f->($value) : $value;
684
+        push @binds, $f ? $f->($value) : $value;
748 685
         
749 686
         # Count up 
750 687
         $count->{$column}++;
751 688
     }
752 689
     
753
-    return \@bind_values;
690
+    return \@binds;
754 691
 }
755 692
 
756 693
 sub _croak {
... ...
@@ -772,6 +709,64 @@ sub _croak {
772 709
     }
773 710
 }
774 711
 
712
+# Deprecated
713
+__PACKAGE__->attr(cache_method => sub {
714
+    sub {
715
+        my $self = shift;
716
+        
717
+        $self->{_cached} ||= {};
718
+        
719
+        if (@_ > 1) {
720
+            $self->{_cached}{$_[0]} = $_[1] 
721
+        }
722
+        else {
723
+            return $self->{_cached}{$_[0]}
724
+        }
725
+    }
726
+});
727
+
728
+sub default_bind_filter {
729
+    my $self = shift;
730
+    
731
+    if (@_) {
732
+        my $fname = $_[0];
733
+        
734
+        if (@_ && !$fname) {
735
+            $self->{default_out_filter} = undef;
736
+        }
737
+        else {
738
+            croak qq{"$fname" is not registered}
739
+              unless exists $self->filters->{$fname};
740
+        
741
+            $self->{default_out_filter} = $self->filters->{$fname};
742
+        }
743
+        return $self;
744
+    }
745
+    
746
+    return $self->{default_out_filter};
747
+}
748
+
749
+sub default_fetch_filter {
750
+    my $self = shift;
751
+    my $fname = $_[0];
752
+    
753
+    if (@_) {
754
+        if (@_ && !$fname) {
755
+            $self->{default_in_filter} = undef;
756
+        }
757
+        else {
758
+            croak qq{"$fname" is not registered}
759
+              unless exists $self->filters->{$fname};
760
+        
761
+            $self->{default_in_filter} = $self->filters->{$fname};
762
+        }
763
+        
764
+        return $self;
765
+    }
766
+    
767
+    return $self->{default_in_filter}
768
+}
769
+
775 770
 1;
776 771
 
777 772
 =head1 NAME
... ...
@@ -907,30 +902,6 @@ See L<DBIx::Custom::Guides> for more details.
907 902
 Enable parsed L<DBIx::Custom::Query> object caching.
908 903
 Default to 1.
909 904
 
910
-=head2 C<cache_method>
911
-
912
-    $dbi          = $dbi->cache_method(\&cache_method);
913
-    $cache_method = $dbi->cache_method
914
-
915
-Method to set and get caches.
916
-
917
-B<Example:>
918
-
919
-    $dbi->cache_method(
920
-        sub {
921
-            my $self = shift;
922
-            
923
-            $self->{_cached} ||= {};
924
-            
925
-            if (@_ > 1) {
926
-                $self->{_cached}{$_[0]} = $_[1] 
927
-            }
928
-            else {
929
-                return $self->{_cached}{$_[0]}
930
-            }
931
-        }
932
-    );
933
-
934 905
 =head2 C<data_source>
935 906
 
936 907
     my $data_source = $dbi->data_source;
... ...
@@ -1076,18 +1047,6 @@ instead of suger methods.
1076 1047
 
1077 1048
     $dbi->execute($query, {author => 'Ken', title => '%Perl%'});
1078 1049
 
1079
-=head2 C<(deprecated) default_bind_filter>
1080
-
1081
-    my $default_bind_filter = $dbi->default_bind_filter;
1082
-    $dbi                    = $dbi->default_bind_filter($fname);
1083
-
1084
-Default filter when parameter binding is executed.
1085
-
1086
-=head2 C<(deprecated) default_fetch_filter>
1087
-
1088
-    my $default_fetch_filter = $dbi->default_fetch_filter;
1089
-    $dbi = $dbi->default_fetch_filter($fname);
1090
-
1091 1050
 =head2 C<execute>
1092 1051
 
1093 1052
     my $result = $dbi->execute($query,  param => $params, filter => \%filter);
... ...
@@ -1376,7 +1335,7 @@ Rollback is automatically done.
1376 1335
 Note that this is feature of L<DBIx::TransactionManager>
1377 1336
 L<DBIx::TransactionManager> is required.
1378 1337
 
1379
-=head2 C<table>
1338
+=head2 C<(experimental) table>
1380 1339
 
1381 1340
     $dbi->table('book',
1382 1341
         insert => sub { ... },
... ...
@@ -1406,6 +1365,42 @@ B<Example:>
1406 1365
                      param  => {author => 'taro'},
1407 1366
                      filter => {author => 'encode_utf8'});
1408 1367
 
1368
+=head2 C<(deprecated) default_bind_filter>
1369
+
1370
+    my $default_bind_filter = $dbi->default_bind_filter;
1371
+    $dbi                    = $dbi->default_bind_filter($fname);
1372
+
1373
+Default filter when parameter binding is executed.
1374
+
1375
+=head2 C<(deprecated) default_fetch_filter>
1376
+
1377
+    my $default_fetch_filter = $dbi->default_fetch_filter;
1378
+    $dbi = $dbi->default_fetch_filter($fname);
1379
+
1380
+=head2 C<(deprecated) cache_method>
1381
+
1382
+    $dbi          = $dbi->cache_method(\&cache_method);
1383
+    $cache_method = $dbi->cache_method
1384
+
1385
+Method to set and get caches.
1386
+
1387
+B<Example:>
1388
+
1389
+    $dbi->cache_method(
1390
+        sub {
1391
+            my $self = shift;
1392
+            
1393
+            $self->{_cached} ||= {};
1394
+            
1395
+            if (@_ > 1) {
1396
+                $self->{_cached}{$_[0]} = $_[1] 
1397
+            }
1398
+            else {
1399
+                return $self->{_cached}{$_[0]}
1400
+            }
1401
+        }
1402
+    );
1403
+
1409 1404
 =head1 STABILITY
1410 1405
 
1411 1406
 L<DBIx::Custom> is now stable. APIs keep backword compatible in the feature.
+1 -49
lib/DBIx/Custom/Guides.pod
... ...
@@ -302,7 +302,7 @@ If you want to register filter, use C<register_filter()> method.
302 302
         }
303 303
     );
304 304
 
305
-C<encode_utf8> and C<decode_utf8> filter is registerd by default.
305
+
306 306
 
307 307
 You can specify these filters to C<filter> argument of C<execute()> method.
308 308
 
... ...
@@ -330,59 +330,11 @@ C<delete()>, C<delete_all()>, C<select()>.
330 330
         filter => {title => 'encode_utf8'}
331 331
     );
332 332
 
333
-Filter works each parmeter, but you prepare default filter for all parameters.
334
-
335
-    $dbi->default_bind_filter('encode_utf8');
336
-
337
-C<filter()> argument overwrites this default filter.
338
-    
339
-    $dbi->default_bind_filter('encode_utf8');
340
-    $dbi->insert(
341
-        table  => 'book',
342
-        param  => {title => 'Perl', author => 'Ken', price => 1000},
343
-        filter => {author => 'to_upper_case', price => undef}
344
-    );
345
-
346
-This is same as the following example.
347
-
348
-    $dbi->insert(
349
-        table  => 'book',
350
-        param  => {title => 'Perl', author => 'Ken', price => 1000},
351
-        filter => {title => 'encode_uft8' author => 'to_upper_case'}
352
-    );
353
-
354 333
 You can also specify filter when the row is fetched. This is reverse of bind filter.
355 334
 
356 335
     my $result = $dbi->select(table => 'book');
357 336
     $result->filter({title => 'decode_utf8', author => 'to_upper_case'});
358 337
 
359
-Filter works each column value, but you prepare a default filter
360
-for all clumn value.
361
-
362
-    $dbi->default_fetch_filter('decode_utf8');
363
-
364
-C<filter()> method of L<DBIx::Custom::Result>
365
-overwrites this default filter.
366
-
367
-    $dbi->default_fetch_filter('decode_utf8');
368
-    my $result = $dbi->select(
369
-        table => 'book',
370
-        columns => ['title', 'author', 'price']
371
-    );
372
-    $result->filter({author => 'to_upper_case', price => undef});
373
-
374
-This is same as the following one.
375
-
376
-    my $result = $dbi->select(
377
-        table => 'book',
378
-        columns => ['title', 'author', 'price']
379
-    );
380
-    $result->filter({title => 'decode_utf8', author => 'to_upper_case'});
381
-
382
-Note that in fetch filter, column names must be lower case
383
-even if the column name conatains upper case charactors.
384
-This is requirment not to depend database systems.
385
-
386 338
 B<Filter examples>
387 339
 
388 340
 MySQL
-89
lib/DBIx/Custom/Guides/Ja.pod
... ...
@@ -439,25 +439,6 @@ C<delete()>、C<select()>
439 439
         filter => {title => 'encode_utf8'}
440 440
     );
441 441
 
442
-C<filter>で指定されたフィルタはそれぞれのパラメータの値に働きますが、
443
-すべてのパラメータのためのデフォルトのフィルタを設定することもできます。
444
-
445
-    $dbi->default_bind_filter('encode_utf8');
446
-
447
-C<filter()>オプションで指定されたフィルタは、
448
-デフォルトのフィルタを上書きます。
449
-    
450
-    $dbi->default_bind_filter('encode_utf8');
451
-    $dbi->insert(
452
-        table  => 'book',
453
-        param  => {title => 'Perl', author => 'Ken', price => 1000},
454
-        filter => {author => 'to_upper_case', price => undef}
455
-    );
456
-
457
-C<title>の値にはデフォルトのフィルタであるC<encode_utf8>が適用され
458
-C<author>の値にはC<to_upper_case>が適用されます。
459
-C<price>にはundefを設定しているのでフィルタが解除されます。
460
-
461 442
 B<フィルタのサンプル>
462 443
 
463 444
 MySQL
... ...
@@ -513,24 +494,6 @@ SQLite
513 494
     my $result = $dbi->select(table => 'book');
514 495
     $result->filter({title => 'decode_utf8', author => 'to_upper_case'});
515 496
 
516
-フィルタはそれぞれの列の値に作用しますが、
517
-すべての列のためのデフォルのトフィルタを設定することもできます。
518
-
519
-    $dbi->default_fetch_filter('decode_utf8');
520
-
521
-C<filter>メソッドで設定されたフィルタはデフォルトのフィルタを上書きます。
522
-
523
-    $dbi->default_fetch_filter('decode_utf8');
524
-    my $result = $dbi->select(
525
-        table => 'book',
526
-        columns => ['title', 'author', 'price']
527
-    );
528
-    $result->filter({author => 'to_upper_case', price => undef});
529
-
530
-C<title>の値にはデフォルトのフィルタであるC<decode_utf8>が適用され
531
-C<author>の値にはC<to_upper_case>が適用されます。
532
-C<price>にはundefを設定しているのでフィルタが解除されます。
533
-
534 497
 フェッチのためのフィルタにおいて、
535 498
 たとえ、列名が大文字を含む場合であっても
536 499
 列名は小文字であることに注意してください。
... ...
@@ -538,18 +501,6 @@ C<price>にはundefを設定しているのでフィルタが解除されます
538 501
 
539 502
 =head2 6. パフォーマンスの改善
540 503
 
541
-=head3 フィルタのチェックを無効にする
542
-
543
-フィルタのチェックがデフォルトでは有効になっています。
544
-これは正しいフィルタ名が指定されているかどうかをチェック
545
-するためのものですが、ときにはパフォーマンスに影響を
546
-及ぼす可能性があります。
547
-
548
-フィルタのチェックを無効にするにはC<filter_check>
549
-に0を設定してください。
550
-
551
-    $dbi->filter_check(0);
552
-
553 504
 =head3 シュガーメソッドを使わない
554 505
 
555 506
 もしC<insert()>メソッドを使用してインサートを実行した場合、
... ...
@@ -588,46 +539,6 @@ C<insert()>メソッドは、SQL文とステートメントハンドルを
588 539
 C<execute>メソッドの第一引数にクエリオブジェトを渡すことができます。
589 540
 これはC<insert()>メソッドよりも高速です。
590 541
 
591
-=head3 キャッシング
592
-
593
-C<execute()>メソッドはデフォルトでSQL文への解析結果をキャッシュします。
594
-
595
-    $dbi->cache(1);
596
-
597
-キャッシングはメモリ上で行われますが、C<cache_method()>
598
-を使って変更することができます。これはキャッシュされるデータの保存と取得
599
-のためのメソッドを定義するのに利用されます。
600
-
601
-    $dbi->cache_method(sub {
602
-        sub {
603
-            my $self = shift;
604
-            
605
-            $self->{_cached} ||= {};
606
-            
607
-            # Set cache
608
-            if (@_ > 1) {
609
-                $self->{_cached}{$_[0]} = $_[1] 
610
-            }
611
-            
612
-            # Get cache
613
-            else {
614
-                return $self->{_cached}{$_[0]}
615
-            }
616
-        }
617
-    });
618
-
619
-最初の引数はL<DBIx::Custom>です。第二引数は、
620
-"select * from book where {= title} and {= author};";
621
-のようなSQL文の源です。
622
-第三引数は
623
-{sql => "select * from book where title = ? and author = ?",
624
- columns => ['title', 'author']}
625
-のような解析後のデータです。これはハッシュリファレンスである必要
626
-があります。
627
-もし引数がふたつより大きい場合は、このメソッドはキャッシュを保存
628
-するのに利用されます。そうでない場合はキャッシュを取得するのに
629
-利用されます。
630
-
631 542
 =head2 7. その他の機能
632 543
 
633 544
 =head3 トランザクション
+29 -28
lib/DBIx/Custom/Result.pm
... ...
@@ -9,27 +9,6 @@ use Carp 'croak';
9 9
 
10 10
 __PACKAGE__->attr([qw/filter_check filters sth/]);
11 11
 
12
-sub default_filter {
13
-    my $self = shift;
14
-    
15
-    if (@_) {
16
-        my $fname = $_[0];
17
-        if (@_ && !$fname) {
18
-            $self->{default_filter} = undef;
19
-        }
20
-        else {
21
-            croak qq{"$fname" is not registered}
22
-              unless exists $self->filters->{$fname};
23
-        
24
-            $self->{default_filter} = $self->filters->{$fname};
25
-        }
26
-        
27
-        return $self;
28
-    }
29
-    
30
-    return $self->{default_filter};
31
-}
32
-
33 12
 sub filter {
34 13
     my $self = shift;
35 14
     
... ...
@@ -210,6 +189,28 @@ sub fetch_multi {
210 189
     return $rows;
211 190
 }
212 191
 
192
+# Deprecated
193
+sub default_filter {
194
+    my $self = shift;
195
+    
196
+    if (@_) {
197
+        my $fname = $_[0];
198
+        if (@_ && !$fname) {
199
+            $self->{default_filter} = undef;
200
+        }
201
+        else {
202
+            croak qq{"$fname" is not registered}
203
+              unless exists $self->filters->{$fname};
204
+        
205
+            $self->{default_filter} = $self->filters->{$fname};
206
+        }
207
+        
208
+        return $self;
209
+    }
210
+    
211
+    return $self->{default_filter};
212
+}
213
+
213 214
 1;
214 215
 
215 216
 =head1 NAME
... ...
@@ -301,13 +302,6 @@ Statement handle of L<DBI>.
301 302
 L<DBIx::Custom::Result> inherits all methods from L<Object::Simple>
302 303
 and implements the following new ones.
303 304
 
304
-=head2 C<(deprecated) default_filter>
305
-
306
-    my $default_filter = $result->default_filter;
307
-    $result = $result->default_filter($filter);
308
-
309
-Default filter when a row is fetched.
310
-
311 305
 =head2 C<fetch>
312 306
 
313 307
     my $row = $result->fetch;
... ...
@@ -363,4 +357,11 @@ Row count must be specified.
363 357
     $result    = $result->filter(title  => 'decode_utf8',
364 358
                                  author => 'decode_utf8');
365 359
 
360
+=head2 C<(deprecated) default_filter>
361
+
362
+    my $default_filter = $result->default_filter;
363
+    $result = $result->default_filter($filter);
364
+
365
+Default filter when a row is fetched.
366
+
366 367
 =cut