Showing 3 changed files with 27 additions and 10 deletions
+14
lib/DBIx/Custom.pm
... ...
@@ -478,6 +478,10 @@ sub register_filter {
478 478
     return $invocant;
479 479
 }
480 480
 
481
+sub register_tag_processor {
482
+    return shift->query_builder->register_tag_processor(@_);
483
+}
484
+
481 485
 our %VALID_SELECT_ARGS
482 486
   = map { $_ => 1 } qw/table column where append relation filter query/;
483 487
 
... ...
@@ -1266,6 +1270,16 @@ B<Example:>
1266 1270
         }
1267 1271
     );
1268 1272
 
1273
+=head2 C<register_tag_processor>
1274
+
1275
+    $dbi->register_tag_processor(
1276
+        limit => sub {
1277
+            ...;
1278
+        }
1279
+    );
1280
+
1281
+Register tag processor.
1282
+
1269 1283
 =head2 C<rollback>
1270 1284
 
1271 1285
     $dbi->rollback;
+7 -10
lib/DBIx/Custom/Guides.pod
... ...
@@ -506,12 +506,12 @@ You can change Result class if you need.
506 506
     my $dbi = DBIx::Custom->connect(...);
507 507
     $dbi->result_class('Your::Result');
508 508
 
509
-=head3 Custamize query builder object
509
+=head3 Register tag processor
510 510
 
511 511
 You can custamize query builder object
512 512
 
513 513
     my $dbi = DBIx::Custom->connect(...);
514
-    $dbi->query_builder->register_tag_processor(
514
+    $dbi->register_tag_processor(
515 515
         name => sub {
516 516
            ...
517 517
         }
... ...
@@ -541,16 +541,13 @@ These method can be called from L<DBIx::Custom> object directory.
541 541
 =head2 EXAMPLES
542 542
 
543 543
 =head3 Limit clause
544
-
545
-    my $rows = $dbi->select(
546
-        table => 'table1',
547
-        where => {key1 => 1},
548
-        append => "order by key2 {limit 1 0}" # {limit COUNT OFFSET}
549
-    )->fetch_hash_all;
544
+    
545
+    # {limit COUNT OFFSET}
546
+    select * from book {limit 1 0};
550 547
 
551 548
 SQLite
552 549
 
553
-    $dbi->query_builder->register_tag_processor(
550
+    $dbi->register_tag_processor(
554 551
         limit => sub {
555 552
             my ($count, $offset) = @_;
556 553
             
... ...
@@ -564,7 +561,7 @@ SQLite
564 561
 
565 562
 MySQL
566 563
 
567
-    $dbi->query_builder->register_tag_processor(
564
+    $dbi->register_tag_processor(
568 565
         limit => sub {
569 566
             my ($count, $offset) = @_;
570 567
             
+6
t/dbix-custom-core-sqlite.t
... ...
@@ -915,5 +915,11 @@ test 'dbi_options default';
915 915
 $dbi = DBIx::Custom->new;
916 916
 is_deeply($dbi->dbi_options, {});
917 917
 
918
+test 'register_tag_processor';
919
+$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
920
+$dbi->register_tag_processor(
921
+    a => sub { 1 }
922
+);
923
+is($dbi->query_builder->tag_processors->{a}->(), 1);
918 924
 
919 925