Showing 4 changed files with 1146 additions and 1148 deletions
+3 -3
t/access2007-accdb.t
... ...
@@ -38,9 +38,9 @@ is($model->count, 2);
38 38
 $dbi->insert({key1 => 1, key3 => 2}, table => 'table2');
39 39
 $dbi->separator('-');
40 40
 $row = $model->select(
41
-    table => 'table1',
42
-    column => {table2 => [qw/key3/]},
43
-    join => ['left outer join table2 on table1.key1 = table2.key1']
41
+  table => 'table1',
42
+  column => {table2 => [qw/key3/]},
43
+  join => ['left outer join table2 on table1.key1 = table2.key1']
44 44
 )->one;
45 45
 is_deeply($row, {"table2-key3" => 2});
46 46
 
+3 -3
t/access2010-accdb.t
... ...
@@ -38,9 +38,9 @@ is($model->count, 2);
38 38
 $dbi->insert({key1 => 1, key3 => 2}, table => 'table2');
39 39
 $dbi->separator('-');
40 40
 $row = $model->select(
41
-    table => 'table1',
42
-    column => {table2 => [qw/key3/]},
43
-    join => ['left outer join table2 on table1.key1 = table2.key1']
41
+  table => 'table1',
42
+  column => {table2 => [qw/key3/]},
43
+  join => ['left outer join table2 on table1.key1 = table2.key1']
44 44
 )->one;
45 45
 is_deeply($row, {"table2-key3" => 2});
46 46
 
+1137 -1139
t/common.t
... ...
@@ -85,158 +85,158 @@ my $affected;
85 85
 
86 86
 require MyDBI1;
87 87
 {
88
-    package MyDBI4;
89
-
90
-    use strict;
91
-    use warnings;
92
-
93
-    use base 'DBIx::Custom';
94
-
95
-    sub connect {
96
-        my $self = shift->SUPER::connect(@_);
97
-        
98
-        $self->include_model(
99
-            MyModel2 => [
100
-                $table1,
101
-                {class => $table2, name => $table2}
102
-            ]
103
-        );
104
-    }
88
+  package MyDBI4;
105 89
 
106
-    package MyModel2::Base1;
90
+  use strict;
91
+  use warnings;
107 92
 
108
-    use strict;
109
-    use warnings;
93
+  use base 'DBIx::Custom';
110 94
 
111
-    use base 'DBIx::Custom::Model';
95
+  sub connect {
96
+    my $self = shift->SUPER::connect(@_);
97
+    
98
+    $self->include_model(
99
+      MyModel2 => [
100
+          $table1,
101
+          {class => $table2, name => $table2}
102
+      ]
103
+    );
104
+  }
112 105
 
113
-    package MyModel2::table1;
106
+  package MyModel2::Base1;
114 107
 
115
-    use strict;
116
-    use warnings;
108
+  use strict;
109
+  use warnings;
117 110
 
118
-    use base 'MyModel2::Base1';
111
+  use base 'DBIx::Custom::Model';
119 112
 
120
-    sub insert {
121
-        my ($self, $param) = @_;
122
-        
123
-        return $self->SUPER::insert($param);
124
-    }
113
+  package MyModel2::table1;
125 114
 
126
-    sub list { shift->select; }
115
+  use strict;
116
+  use warnings;
127 117
 
128
-    package MyModel2::table2;
118
+  use base 'MyModel2::Base1';
129 119
 
130
-    use strict;
131
-    use warnings;
120
+  sub insert {
121
+    my ($self, $param) = @_;
122
+    
123
+    return $self->SUPER::insert($param);
124
+  }
132 125
 
133
-    use base 'MyModel2::Base1';
126
+  sub list { shift->select; }
134 127
 
135
-    sub insert {
136
-        my ($self, $param) = @_;
137
-        
138
-        return $self->SUPER::insert($param);
139
-    }
128
+  package MyModel2::table2;
140 129
 
141
-    sub list { shift->select; }
130
+  use strict;
131
+  use warnings;
142 132
 
143
-    package MyModel2::TABLE1;
133
+  use base 'MyModel2::Base1';
144 134
 
145
-    use strict;
146
-    use warnings;
135
+  sub insert {
136
+    my ($self, $param) = @_;
137
+    
138
+    return $self->SUPER::insert($param);
139
+  }
147 140
 
148
-    use base 'MyModel2::Base1';
141
+  sub list { shift->select; }
149 142
 
150
-    sub insert {
151
-        my ($self, $param) = @_;
152
-        
153
-        return $self->SUPER::insert($param);
154
-    }
143
+  package MyModel2::TABLE1;
155 144
 
156
-    sub list { shift->select; }
145
+  use strict;
146
+  use warnings;
157 147
 
158
-    package MyModel2::TABLE2;
148
+  use base 'MyModel2::Base1';
159 149
 
160
-    use strict;
161
-    use warnings;
150
+  sub insert {
151
+    my ($self, $param) = @_;
152
+    
153
+    return $self->SUPER::insert($param);
154
+  }
162 155
 
163
-    use base 'MyModel2::Base1';
156
+  sub list { shift->select; }
164 157
 
165
-    sub insert {
166
-        my ($self, $param) = @_;
167
-        
168
-        return $self->SUPER::insert($param);
169
-    }
158
+  package MyModel2::TABLE2;
170 159
 
171
-    sub list { shift->select; }
160
+  use strict;
161
+  use warnings;
162
+
163
+  use base 'MyModel2::Base1';
164
+
165
+  sub insert {
166
+    my ($self, $param) = @_;
167
+    
168
+    return $self->SUPER::insert($param);
169
+  }
170
+
171
+  sub list { shift->select; }
172 172
 }
173 173
 {
174
-     package MyDBI5;
174
+   package MyDBI5;
175 175
 
176
-    use strict;
177
-    use warnings;
176
+  use strict;
177
+  use warnings;
178 178
 
179
-    use base 'DBIx::Custom';
179
+  use base 'DBIx::Custom';
180 180
 
181
-    sub connect {
182
-        my $self = shift->SUPER::connect(@_);
183
-        
184
-        $self->include_model('MyModel4');
185
-    }
181
+  sub connect {
182
+    my $self = shift->SUPER::connect(@_);
183
+    
184
+    $self->include_model('MyModel4');
185
+  }
186 186
 }
187 187
 {
188
-    package MyDBI6;
188
+  package MyDBI6;
189
+  
190
+  use base 'DBIx::Custom';
191
+  
192
+  sub connect {
193
+    my $self = shift->SUPER::connect(@_);
189 194
     
190
-    use base 'DBIx::Custom';
195
+    $self->include_model('MyModel5');
191 196
     
192
-    sub connect {
193
-        my $self = shift->SUPER::connect(@_);
194
-        
195
-        $self->include_model('MyModel5');
196
-        
197
-        return $self;
198
-    }
197
+    return $self;
198
+  }
199 199
 }
200 200
 {
201
-    package MyDBI7;
201
+  package MyDBI7;
202
+  
203
+  use base 'DBIx::Custom';
204
+  
205
+  sub connect {
206
+    my $self = shift->SUPER::connect(@_);
202 207
     
203
-    use base 'DBIx::Custom';
208
+    $self->include_model('MyModel6');
204 209
     
205
-    sub connect {
206
-        my $self = shift->SUPER::connect(@_);
207
-        
208
-        $self->include_model('MyModel6');
209
-        
210
-        
211
-        return $self;
212
-    }
210
+    
211
+    return $self;
212
+  }
213 213
 }
214 214
 {
215
-    package MyDBI8;
215
+  package MyDBI8;
216
+  
217
+  use base 'DBIx::Custom';
218
+  
219
+  sub connect {
220
+    my $self = shift->SUPER::connect(@_);
216 221
     
217
-    use base 'DBIx::Custom';
222
+    $self->include_model('MyModel7');
218 223
     
219
-    sub connect {
220
-        my $self = shift->SUPER::connect(@_);
221
-        
222
-        $self->include_model('MyModel7');
223
-        
224
-        return $self;
225
-    }
224
+    return $self;
225
+  }
226 226
 }
227 227
 
228 228
 {
229
-    package MyDBI9;
229
+  package MyDBI9;
230
+  
231
+  use base 'DBIx::Custom';
232
+  
233
+  sub connect {
234
+    my $self = shift->SUPER::connect(@_);
230 235
     
231
-    use base 'DBIx::Custom';
236
+    $self->include_model('MyModel8');
232 237
     
233
-    sub connect {
234
-        my $self = shift->SUPER::connect(@_);
235
-        
236
-        $self->include_model('MyModel8');
237
-        
238
-        return $self;
239
-    }
238
+    return $self;
239
+  }
240 240
 }
241 241
 
242 242
 test 'execute reuse option';
... ...
@@ -244,7 +244,7 @@ eval { $dbi->execute("drop table $table1") };
244 244
 $dbi->execute($create_table1);
245 245
 $reuse = {};
246 246
 for my $i (1 .. 2) {
247
-  $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, reuse => $reuse);
247
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, reuse => $reuse);
248 248
 }
249 249
 $rows = $dbi->select(table => $table1)->all;
250 250
 is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 1, $key2 => 2}]);
... ...
@@ -285,14 +285,14 @@ $result = $dbi->execute($query);
285 285
 
286 286
 @rows = ();
287 287
 while (my $row = $result->fetch) {
288
-    push @rows, [@$row];
288
+  push @rows, [@$row];
289 289
 }
290 290
 is_deeply(\@rows, [[1, 2], [3, 4]], "fetch");
291 291
 
292 292
 $result = $dbi->execute($query);
293 293
 @rows = ();
294 294
 while (my $row = $result->fetch_hash) {
295
-    push @rows, {%$row};
295
+  push @rows, {%$row};
296 296
 }
297 297
 is_deeply(\@rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "fetch_hash");
298 298
 
... ...
@@ -325,8 +325,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
325 325
 
326 326
 test 'Filter basic';
327 327
 $dbi->delete_all(table => $table1);
328
-$dbi->register_filter(twice       => sub { $_[0] * 2}, 
329
-                    three_times => sub { $_[0] * 3});
328
+$dbi->register_filter(twice => sub { $_[0] * 2}, 
329
+  three_times => sub { $_[0] * 3});
330 330
 
331 331
 $insert_source  = "insert into $table1 {insert_param $key1 $key2}";
332 332
 $insert_query = $dbi->execute($insert_source, {}, query => 1);
... ...
@@ -405,7 +405,7 @@ $dbi->execute($update_source, {$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $
405 405
 $result = $dbi->execute("select * from $table1 order by $key1");
406 406
 $rows = $result->all;
407 407
 is_deeply($rows, [{$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5},
408
-                  {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}], "basic");
408
+                {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}], "basic");
409 409
 
410 410
 test 'Named placeholder';
411 411
 eval { $dbi->execute("drop table $table1") };
... ...
@@ -430,9 +430,9 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}])
430 430
 
431 431
 $source = "select * from $table1 where $key1 = :$table1.$key1 and $key2 = :$table1.$key2";
432 432
 $result = $dbi->execute(
433
-    $source,
434
-    {"$table1.$key1" => 1, "$table1.$key2" => 1},
435
-    filter => {"$table1.$key2" => sub { $_[0] * 2 }}
433
+  $source,
434
+  {"$table1.$key1" => 1, "$table1.$key2" => 1},
435
+  filter => {"$table1.$key2" => sub { $_[0] * 2 }}
436 436
 );
437 437
 $rows = $result->all;
438 438
 is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}]);
... ...
@@ -442,8 +442,8 @@ $dbi->execute($create_table1);
442 442
 $dbi->insert({$key1 => '2011-10-14 12:19:18', $key2 => 2}, table => $table1);
443 443
 $source = "select * from $table1 where $key1 = '2011-10-14 12:19:18' and $key2 = :$key2";
444 444
 $result = $dbi->execute(
445
-    $source,
446
-    {$key2 => 2},
445
+  $source,
446
+  {$key2 => 2},
447 447
 );
448 448
 
449 449
 $rows = $result->all;
... ...
@@ -454,8 +454,8 @@ $dbi->delete_all(table => $table1);
454 454
 $dbi->insert({$key1 => 'a:b c:d', $key2 => 2}, table => $table1);
455 455
 $source = "select * from $table1 where $key1 = 'a\\:b c\\:d' and $key2 = :$key2";
456 456
 $result = $dbi->execute(
457
-    $source,
458
-    {$key2 => 2},
457
+  $source,
458
+  {$key2 => 2},
459 459
 );
460 460
 $rows = $result->all;
461 461
 is_deeply($rows, [{$key1 => 'a:b c:d', $key2 => 2}]);
... ...
@@ -486,8 +486,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
486 486
 
487 487
 $dbi->execute("delete from $table1");
488 488
 $dbi->register_filter(
489
-    twice       => sub { $_[0] * 2 },
490
-    three_times => sub { $_[0] * 3 }
489
+  twice       => sub { $_[0] * 2 },
490
+  three_times => sub { $_[0] * 3 }
491 491
 );
492 492
 $dbi->default_bind_filter('twice');
493 493
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, filter => {$key1 => 'three_times'});
... ...
@@ -538,7 +538,7 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
538 538
 eval { $dbi->execute("drop table $table1") };
539 539
 $dbi->execute($create_table1);
540 540
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
541
-  wrap => {$key1 => sub { "$_[0] - 1" }});
541
+wrap => {$key1 => sub { "$_[0] - 1" }});
542 542
 $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
543 543
 $result = $dbi->execute("select * from $table1");
544 544
 $rows   = $result->all;
... ...
@@ -547,7 +547,7 @@ is_deeply($rows, [{$key1 => 0, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
547 547
 eval { $dbi->execute("drop table $table1") };
548 548
 $dbi->execute($create_table1);
549 549
 $dbi->insert_timestamp(
550
-    $key1 => '5'
550
+  $key1 => '5'
551 551
 );
552 552
 $dbi->insert({$key2 => 2}, table => $table1, timestamp => 1);
553 553
 $result = $dbi->execute("select * from $table1");
... ...
@@ -557,7 +557,7 @@ is_deeply($rows, [{$key1 => 5, $key2 => 2}], "basic");
557 557
 eval { $dbi->execute("drop table $table1") };
558 558
 $dbi->execute($create_table1);
559 559
 $dbi->insert_timestamp(
560
-    [$key1, $key2] => sub { 5 }
560
+  [$key1, $key2] => sub { 5 }
561 561
 );
562 562
 $dbi->insert(table => $table1, timestamp => 1);
563 563
 $result = $dbi->execute("select * from $table1");
... ...
@@ -567,7 +567,7 @@ is_deeply($rows, [{$key1 => 5, $key2 => 5}], "basic");
567 567
 eval { $dbi->execute("drop table $table1") };
568 568
 $dbi->execute($create_table1);
569 569
 $dbi->insert_timestamp(
570
-    [$key1, $key2] => sub { "" . DBIx::Custom->new }
570
+  [$key1, $key2] => sub { "" . DBIx::Custom->new }
571 571
 );
572 572
 $dbi->insert(table => $table1, timestamp => 1);
573 573
 $result = $dbi->execute("select * from $table1");
... ...
@@ -651,9 +651,9 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
651 651
 eval { $dbi->execute("drop table $table1") };
652 652
 $dbi->execute($create_table1_2);
653 653
 $dbi->insert([{$key1 => 1}, {$key1 => 3}] ,
654
-  table => $table1,
655
-  updated_at => $key2,
656
-  created_at => $key3
654
+table => $table1,
655
+updated_at => $key2,
656
+created_at => $key3
657 657
 );
658 658
 $result = $dbi->execute("select * from $table1");
659 659
 $rows   = $result->all;
... ...
@@ -667,7 +667,7 @@ like($rows->[1]->{$key3}, qr/\d{2}:/);
667 667
 eval { $dbi->execute("drop table $table1") };
668 668
 $dbi->execute($create_table1);
669 669
 $dbi->insert([{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}] ,
670
-  table => $table1, filter => {$key1 => sub { $_[0] * 2 }});
670
+table => $table1, filter => {$key1 => sub { $_[0] * 2 }});
671 671
 $result = $dbi->execute("select * from $table1");
672 672
 $rows   = $result->all;
673 673
 is_deeply($rows, [{$key1 => 2, $key2 => 2}, {$key1 => 6, $key2 => 4}], "basic");
... ...
@@ -676,61 +676,61 @@ test 'update_or_insert';
676 676
 eval { $dbi->execute("drop table $table1") };
677 677
 $dbi->execute($create_table1);
678 678
 $dbi->update_or_insert(
679
-    {$key2 => 2},
680
-    table => $table1,
681
-    primary_key => $key1,
682
-    id => 1
679
+  {$key2 => 2},
680
+  table => $table1,
681
+  primary_key => $key1,
682
+  id => 1
683 683
 );
684 684
 $row = $dbi->select(id => 1, table => $table1, primary_key => $key1)->one;
685 685
 is_deeply($row, {$key1 => 1, $key2 => 2}, "basic");
686 686
 
687 687
 $dbi->update_or_insert(
688
-    {$key2 => 3},
689
-    table => $table1,
690
-    primary_key => $key1,
691
-    id => 1
688
+  {$key2 => 3},
689
+  table => $table1,
690
+  primary_key => $key1,
691
+  id => 1
692 692
 );
693 693
 $rows = $dbi->select(id => 1, table => $table1, primary_key => $key1)->all;
694 694
 is_deeply($rows, [{$key1 => 1, $key2 => 3}], "basic");
695 695
 
696 696
 eval {
697
-    $dbi->update_or_insert(
698
-        {$key2 => 3},
699
-        table => $table1,
700
-    );
697
+  $dbi->update_or_insert(
698
+    {$key2 => 3},
699
+    table => $table1,
700
+  );
701 701
 };
702 702
 
703 703
 like($@, qr/primary_key/);
704 704
 
705 705
 eval {
706
-    $dbi->insert({$key1 => 1}, table => $table1);
707
-    $dbi->update_or_insert(
708
-        {$key2 => 3},
709
-        table => $table1,
710
-        primary_key => $key1,
711
-        id => 1
712
-    );
706
+  $dbi->insert({$key1 => 1}, table => $table1);
707
+  $dbi->update_or_insert(
708
+    {$key2 => 3},
709
+    table => $table1,
710
+    primary_key => $key1,
711
+    id => 1
712
+  );
713 713
 };
714 714
 like($@, qr/one/);
715 715
 
716 716
 eval { $dbi->execute("drop table $table1") };
717 717
 $dbi->execute($create_table1);
718 718
 $dbi->update_or_insert(
719
-    {},
720
-    table => $table1,
721
-    primary_key => $key1,
722
-    id => 1
719
+  {},
720
+  table => $table1,
721
+  primary_key => $key1,
722
+  id => 1
723 723
 );
724 724
 $row = $dbi->select(id => 1, table => $table1, primary_key => $key1)->one;
725 725
 is($row->{$key1}, 1);
726 726
 
727 727
 eval { 
728
-    $affected = $dbi->update_or_insert(
729
-        {},
730
-        table => $table1,
731
-        primary_key => $key1,
732
-        id => 1
733
-    );
728
+  $affected = $dbi->update_or_insert(
729
+    {},
730
+    table => $table1,
731
+    primary_key => $key1,
732
+    id => 1
733
+  );
734 734
 };
735 735
 is($affected, 0);
736 736
 
... ...
@@ -738,27 +738,27 @@ test 'model update_or_insert';
738 738
 eval { $dbi->execute("drop table $table1") };
739 739
 $dbi->execute($create_table1);
740 740
 $model = $dbi->create_model(
741
-    table => $table1,
742
-    primary_key => $key1
741
+  table => $table1,
742
+  primary_key => $key1
743 743
 );
744 744
 $model->update_or_insert({$key2 => 2}, id => 1);
745 745
 $row = $model->select(id => 1)->one;
746 746
 is_deeply($row, {$key1 => 1, $key2 => 2}, "basic");
747 747
 
748 748
 eval {
749
-    $model->insert({$key1 => 1});
750
-    $model->update_or_insert(
751
-        {$key2 => 3},
752
-        id => 1
753
-    );
749
+  $model->insert({$key1 => 1});
750
+  $model->update_or_insert(
751
+    {$key2 => 3},
752
+    id => 1
753
+  );
754 754
 };
755 755
 like($@, qr/one/);
756 756
 
757 757
 test 'default_bind_filter';
758 758
 $dbi->execute("delete from $table1");
759 759
 $dbi->register_filter(
760
-    twice       => sub { $_[0] * 2 },
761
-    three_times => sub { $_[0] * 3 }
760
+  twice       => sub { $_[0] * 2 },
761
+  three_times => sub { $_[0] * 3 }
762 762
 );
763 763
 $dbi->default_bind_filter('twice');
764 764
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, filter => {$key1 => 'three_times'});
... ...
@@ -776,8 +776,8 @@ $dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1});
776 776
 $result = $dbi->execute("select * from $table1 order by $key1");
777 777
 $rows   = $result->all;
778 778
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
779
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
780
-                  "basic");
779
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
780
+  "basic");
781 781
 
782 782
 eval { $dbi->execute("drop table $table1") };
783 783
 $dbi->execute($create_table1_2);
... ...
@@ -787,9 +787,9 @@ $dbi->update(param => {$key2 => 11}, table => $table1, where => {$key1 => 1});
787 787
 $result = $dbi->execute("select * from $table1 order by $key1");
788 788
 $rows   = $result->all;
789 789
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
790
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
791
-                  "basic");
792
-                  
790
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
791
+  "basic");
792
+                
793 793
 $dbi->execute("delete from $table1");
794 794
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
795 795
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
... ...
@@ -797,27 +797,27 @@ $dbi->update({$key2 => 12}, table => $table1, where => {$key2 => 2, $key3 => 3})
797 797
 $result = $dbi->execute("select * from $table1 order by $key1");
798 798
 $rows   = $result->all;
799 799
 is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
800
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
801
-                  "update key same as search key");
800
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
801
+  "update key same as search key");
802 802
 
803 803
 $dbi->update({$key2 => [12]}, table => $table1, where => {$key2 => 2, $key3 => 3});
804 804
 $result = $dbi->execute("select * from $table1 order by $key1");
805 805
 $rows   = $result->all;
806 806
 is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
807
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
808
-                  "update key same as search key : param is array ref");
807
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
808
+  "update key same as search key : param is array ref");
809 809
 
810 810
 $dbi->execute("delete from $table1");
811 811
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
812 812
 $dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
813 813
 $dbi->register_filter(twice => sub { $_[0] * 2 });
814 814
 $dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1},
815
-              filter => {$key2 => sub { $_[0] * 2 }});
815
+            filter => {$key2 => sub { $_[0] * 2 }});
816 816
 $result = $dbi->execute("select * from $table1 order by $key1");
817 817
 $rows   = $result->all;
818 818
 is_deeply($rows, [{$key1 => 1, $key2 => 22, $key3 => 3, $key4 => 4, $key5 => 5},
819
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
820
-                  "filter");
819
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
820
+  "filter");
821 821
 
822 822
 $result = $dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1}, append => '   ');
823 823
 
... ...
@@ -838,12 +838,12 @@ eval { $dbi->execute("drop table $table1") };
838 838
 $dbi->execute($create_table1);
839 839
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
840 840
 $dbi->update(
841
-    {$key1 => 3},
842
-    table => $table1,
843
-    where => [
844
-        ['and', "$key1 = :$key1", "$key2 = :$key2"],
845
-        {$key1 => 1, $key2 => 2}
846
-    ]
841
+  {$key1 => 3},
842
+  table => $table1,
843
+  where => [
844
+    ['and', "$key1 = :$key1", "$key2 = :$key2"],
845
+    {$key1 => 1, $key2 => 2}
846
+  ]
847 847
 );
848 848
 $result = $dbi->select(table => $table1);
849 849
 is_deeply($result->all, [{$key1 => 3, $key2 => 2}], 'update() where');
... ...
@@ -896,8 +896,8 @@ $dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1});
896 896
 $result = $dbi->execute("select * from $table1 order by $key1");
897 897
 $rows   = $result->all;
898 898
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
899
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
900
-                  "basic");
899
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
900
+  "basic");
901 901
 
902 902
 eval { $dbi->execute("drop table $table1") };
903 903
 $dbi->execute($create_table1_2);
... ...
@@ -908,8 +908,8 @@ wrap => {$key2 => sub { "$_[0] - 1" }});
908 908
 $result = $dbi->execute("select * from $table1 order by $key1");
909 909
 $rows   = $result->all;
910 910
 is_deeply($rows, [{$key1 => 1, $key2 => 10, $key3 => 3, $key4 => 4, $key5 => 5},
911
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
912
-                  "basic");
911
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
912
+  "basic");
913 913
 
914 914
 eval { $dbi->execute("drop table $table1") };
915 915
 $dbi->execute($create_table1_2);
... ...
@@ -919,13 +919,13 @@ $dbi->update({$key2 => \"'11'"}, table => $table1, where => {$key1 => 1});
919 919
 $result = $dbi->execute("select * from $table1 order by $key1");
920 920
 $rows   = $result->all;
921 921
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
922
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
923
-                  "basic");
922
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
923
+  "basic");
924 924
 
925 925
 eval { $dbi->execute("drop table $table1") };
926 926
 $dbi->execute($create_table1);
927 927
 $dbi->update_timestamp(
928
-    $key1 => '5'
928
+  $key1 => '5'
929 929
 );
930 930
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
931 931
 $dbi->update(table => $table1, timestamp => 1, where => {$key2 => 2});
... ...
@@ -936,7 +936,7 @@ is_deeply($rows, [{$key1 => 5, $key2 => 2}], "basic");
936 936
 eval { $dbi->execute("drop table $table1") };
937 937
 $dbi->execute($create_table1);
938 938
 $dbi->update_timestamp(
939
-    [$key1, $key2] => sub { '5' }
939
+  [$key1, $key2] => sub { '5' }
940 940
 );
941 941
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
942 942
 $dbi->update_all(table => $table1, timestamp => 1);
... ...
@@ -947,7 +947,7 @@ is_deeply($rows, [{$key1 => 5, $key2 => 5}], "basic");
947 947
 eval { $dbi->execute("drop table $table1") };
948 948
 $dbi->execute($create_table1);
949 949
 $dbi->update_timestamp(
950
-    [$key1, $key2] => sub { "" . DBIx::Custom->new }
950
+  [$key1, $key2] => sub { "" . DBIx::Custom->new }
951 951
 );
952 952
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
953 953
 $dbi->update_all(table => $table1, timestamp => 1);
... ...
@@ -965,8 +965,8 @@ is_deeply($param, {$key2 => 11});
965 965
 $result = $dbi->execute("select * from $table1 order by $key1");
966 966
 $rows   = $result->all;
967 967
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
968
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
969
-                  "basic");
968
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
969
+  "basic");
970 970
 
971 971
 eval { $dbi->execute("drop table $table1") };
972 972
 $dbi->execute($create_table1_2);
... ...
@@ -978,8 +978,8 @@ is_deeply($param, {$key2 => 11});
978 978
 $result = $dbi->execute("select * from $table1 order by $key1");
979 979
 $rows   = $result->all;
980 980
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
981
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
982
-                  "basic");
981
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
982
+  "basic");
983 983
 
984 984
 eval { $dbi->execute("drop table $table1") };
985 985
 $dbi->execute($create_table1_2);
... ...
@@ -1025,9 +1025,8 @@ $dbi->update_all({$key2 => 10}, table => $table1, filter => {$key2 => 'twice'});
1025 1025
 $result = $dbi->execute("select * from $table1");
1026 1026
 $rows   = $result->all;
1027 1027
 is_deeply($rows, [{$key1 => 1, $key2 => 20, $key3 => 3, $key4 => 4, $key5 => 5},
1028
-                  {$key1 => 6, $key2 => 20, $key3 => 8, $key4 => 9, $key5 => 10}],
1029
-                  "filter");
1030
-
1028
+  {$key1 => 6, $key2 => 20, $key3 => 8, $key4 => 9, $key5 => 10}],
1029
+  "filter");
1031 1030
 
1032 1031
 test 'delete';
1033 1032
 eval { $dbi->execute("drop table $table1") };
... ...
@@ -1073,11 +1072,11 @@ $dbi->execute($create_table1);
1073 1072
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1074 1073
 $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1075 1074
 $dbi->delete(
1076
-    table => $table1,
1077
-    where => [
1078
-        ['and', "$key1 = :$key1", "$key2 = :$key2"],
1079
-        {ke1 => 1, $key2 => 2}
1080
-    ]
1075
+  table => $table1,
1076
+  where => [
1077
+    ['and', "$key1 = :$key1", "$key2 = :$key2"],
1078
+    {ke1 => 1, $key2 => 2}
1079
+  ]
1081 1080
 );
1082 1081
 $result = $dbi->select(table => $table1);
1083 1082
 is_deeply($result->all, [{$key1 => 3, $key2 => 4}], 'delete() where');
... ...
@@ -1120,7 +1119,6 @@ $result = $dbi->execute("select * from $table1");
1120 1119
 $rows   = $result->all;
1121 1120
 is_deeply($rows, [], "basic");
1122 1121
 
1123
-
1124 1122
 test 'select';
1125 1123
 eval { $dbi->execute("drop table $table1") };
1126 1124
 $dbi->execute($create_table1);
... ...
@@ -1128,7 +1126,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1128 1126
 $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1129 1127
 $rows = $dbi->select(table => $table1)->all;
1130 1128
 is_deeply($rows, [{$key1 => 1, $key2 => 2},
1131
-                  {$key1 => 3, $key2 => 4}], "table");
1129
+  {$key1 => 3, $key2 => 4}], "table");
1132 1130
 
1133 1131
 $rows = $dbi->select(table => $table1, column => [$key1])->all;
1134 1132
 is_deeply($rows, [{$key1 => 1}, {$key1 => 3}], "table and columns and where key");
... ...
@@ -1141,24 +1139,24 @@ is_deeply($rows, [{$key1 => 3}], "table and columns and where key");
1141 1139
 
1142 1140
 $dbi->register_filter(decrement => sub { $_[0] - 1 });
1143 1141
 $rows = $dbi->select(table => $table1, where => {$key1 => 2}, filter => {$key1 => 'decrement'})
1144
-            ->all;
1142
+          ->all;
1145 1143
 is_deeply($rows, [{$key1 => 1, $key2 => 2}], "filter");
1146 1144
 
1147 1145
 eval { $dbi->execute("drop table $table2") };
1148 1146
 $dbi->execute($create_table2);
1149 1147
 $dbi->insert({$key1 => 1, $key3 => 5}, table => $table2);
1150 1148
 $rows = $dbi->select(
1151
-    table => [$table1, $table2],
1152
-    column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
1153
-    where   => {"$table1.$key2" => 2},
1154
-    relation  => {"$table1.$key1" => "$table2.$key1"}
1149
+  table => [$table1, $table2],
1150
+  column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
1151
+  where   => {"$table1.$key2" => 2},
1152
+  relation  => {"$table1.$key1" => "$table2.$key1"}
1155 1153
 )->all;
1156 1154
 is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : exists where");
1157 1155
 
1158 1156
 $rows = $dbi->select(
1159
-    table => [$table1, $table2],
1160
-    column => ["$table1.$key1 as ${table1}_$key1", "${table2}.$key1 as ${table2}_$key1", $key2, $key3],
1161
-    relation  => {"$table1.$key1" => "$table2.$key1"}
1157
+  table => [$table1, $table2],
1158
+  column => ["$table1.$key1 as ${table1}_$key1", "${table2}.$key1 as ${table2}_$key1", $key2, $key3],
1159
+  relation  => {"$table1.$key1" => "$table2.$key1"}
1162 1160
 )->all;
1163 1161
 is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : no exists where");
1164 1162
 
... ...
@@ -1180,8 +1178,8 @@ is_deeply($row, {$key1 => 1});
1180 1178
 test 'fetch filter';
1181 1179
 eval { $dbi->execute("drop table $table1") };
1182 1180
 $dbi->register_filter(
1183
-    twice       => sub { $_[0] * 2 },
1184
-    three_times => sub { $_[0] * 3 }
1181
+  twice       => sub { $_[0] * 2 },
1182
+  three_times => sub { $_[0] * 3 }
1185 1183
 );
1186 1184
 $dbi->default_fetch_filter('twice');
1187 1185
 $dbi->execute($create_table1);
... ...
@@ -1210,10 +1208,10 @@ test 'filters';
1210 1208
 $dbi = DBIx::Custom->new;
1211 1209
 
1212 1210
 is($dbi->filters->{decode_utf8}->(encode_utf8('あ')),
1213
-   'あ', "decode_utf8");
1211
+  'あ', "decode_utf8");
1214 1212
 
1215 1213
 is($dbi->filters->{encode_utf8}->('あ'),
1216
-   encode_utf8('あ'), "encode_utf8");
1214
+  encode_utf8('あ'), "encode_utf8");
1217 1215
 
1218 1216
 test 'transaction1';
1219 1217
 $dbi = DBIx::Custom->connect;
... ...
@@ -1240,21 +1238,21 @@ $dbi->commit;
1240 1238
 $dbi->dbh->{AutoCommit} = 1;
1241 1239
 $result = $dbi->select(table => $table1);
1242 1240
 is_deeply(scalar $result->all, [{$key1 => 1, $key2 => 2}, {$key1 => 2, $key2 => 3}],
1243
-          "commit");
1241
+  "commit");
1244 1242
 
1245 1243
 test 'execute';
1246 1244
 eval { $dbi->execute("drop table $table1") };
1247 1245
 $dbi->execute($create_table1);
1248 1246
 {
1249
-    local $Carp::Verbose = 0;
1250
-    eval{$dbi->execute("select * frm $table1")};
1251
-    like($@, qr/\Qselect * frm $table1/, "fail prepare");
1252
-    like($@, qr/\.t /, "fail : not verbose");
1247
+  local $Carp::Verbose = 0;
1248
+  eval{$dbi->execute("select * frm $table1")};
1249
+  like($@, qr/\Qselect * frm $table1/, "fail prepare");
1250
+  like($@, qr/\.t /, "fail : not verbose");
1253 1251
 }
1254 1252
 {
1255
-    local $Carp::Verbose = 1;
1256
-    eval{$dbi->execute("select * frm $table1")};
1257
-    like($@, qr/Custom.*\.t /s, "fail : verbose");
1253
+  local $Carp::Verbose = 1;
1254
+  eval{$dbi->execute("select * frm $table1")};
1255
+  like($@, qr/Custom.*\.t /s, "fail : verbose");
1258 1256
 }
1259 1257
 
1260 1258
 $query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1);
... ...
@@ -1263,14 +1261,14 @@ eval{$dbi->execute($query, {$key1 => {a => 1}})};
1263 1261
 ok($@, "execute fail");
1264 1262
 
1265 1263
 {
1266
-    local $Carp::Verbose = 0;
1267
-    eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1268
-    like($@, qr/\Q.t /, "caller spec : not vebose");
1264
+  local $Carp::Verbose = 0;
1265
+  eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1266
+  like($@, qr/\Q.t /, "caller spec : not vebose");
1269 1267
 }
1270 1268
 {
1271
-    local $Carp::Verbose = 1;
1272
-    eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1273
-    like($@, qr/QueryBuilder.*\.t /s, "caller spec : not vebose");
1269
+  local $Carp::Verbose = 1;
1270
+  eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1271
+  like($@, qr/QueryBuilder.*\.t /s, "caller spec : not vebose");
1274 1272
 }
1275 1273
 
1276 1274
 
... ...
@@ -1282,9 +1280,9 @@ $dbi->execute($create_table1);
1282 1280
 $dbi->begin_work;
1283 1281
 
1284 1282
 eval {
1285
-    $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1286
-    die "Error";
1287
-    $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1283
+  $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1284
+  die "Error";
1285
+  $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1288 1286
 };
1289 1287
 
1290 1288
 $dbi->rollback if $@;
... ...
@@ -1296,8 +1294,8 @@ is_deeply($rows, [], "rollback");
1296 1294
 $dbi->begin_work;
1297 1295
 
1298 1296
 eval {
1299
-    $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1300
-    $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1297
+  $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1298
+  $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1301 1299
 };
1302 1300
 
1303 1301
 $dbi->commit unless $@;
... ...
@@ -1318,7 +1316,7 @@ $dbi->execute($create_table1);
1318 1316
 $source = "select * from $table1 where $key1 = :$key1 and $key2 = :$key2";
1319 1317
 $dbi->execute($source, {}, query => 1);
1320 1318
 is_deeply($dbi->{_cached}->{$source}, 
1321
-          {sql => " select * from $table1 where $key1 = ?  and $key2 = ? ", columns => [$key1, $key2], tables => []}, "cache");
1319
+  {sql => " select * from $table1 where $key1 = ?  and $key2 = ? ", columns => [$key1, $key2], tables => []}, "cache");
1322 1320
 
1323 1321
 eval { $dbi->execute("drop table $table1") };
1324 1322
 $dbi->execute($create_table1);
... ...
@@ -1331,15 +1329,15 @@ test 'execute';
1331 1329
 eval { $dbi->execute("drop table $table1") };
1332 1330
 $dbi->execute($create_table1);
1333 1331
 {
1334
-    local $Carp::Verbose = 0;
1335
-    eval{$dbi->execute("select * frm $table1")};
1336
-    like($@, qr/\Qselect * frm $table1/, "fail prepare");
1337
-    like($@, qr/\.t /, "fail : not verbose");
1332
+  local $Carp::Verbose = 0;
1333
+  eval{$dbi->execute("select * frm $table1")};
1334
+  like($@, qr/\Qselect * frm $table1/, "fail prepare");
1335
+  like($@, qr/\.t /, "fail : not verbose");
1338 1336
 }
1339 1337
 {
1340
-    local $Carp::Verbose = 1;
1341
-    eval{$dbi->execute("select * frm $table1")};
1342
-    like($@, qr/Custom.*\.t /s, "fail : verbose");
1338
+  local $Carp::Verbose = 1;
1339
+  eval{$dbi->execute("select * frm $table1")};
1340
+  like($@, qr/Custom.*\.t /s, "fail : verbose");
1343 1341
 }
1344 1342
 
1345 1343
 $query = $dbi->execute("select * from $table1 where $key1 = :$key1", {}, query => 1);
... ...
@@ -1348,28 +1346,28 @@ eval{$dbi->execute($query, {$key1 => {a => 1}})};
1348 1346
 ok($@, "execute fail");
1349 1347
 
1350 1348
 {
1351
-    local $Carp::Verbose = 0;
1352
-    eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1353
-    like($@, qr/\Q.t /, "caller spec : not vebose");
1349
+  local $Carp::Verbose = 0;
1350
+  eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1351
+  like($@, qr/\Q.t /, "caller spec : not vebose");
1354 1352
 }
1355 1353
 {
1356
-    local $Carp::Verbose = 1;
1357
-    eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1358
-    like($@, qr/QueryBuilder.*\.t /s, "caller spec : not vebose");
1354
+  local $Carp::Verbose = 1;
1355
+  eval{$dbi->execute("select * from $table1 where {0 $key1}", {}, query => 1)};
1356
+  like($@, qr/QueryBuilder.*\.t /s, "caller spec : not vebose");
1359 1357
 }
1360 1358
 
1361 1359
 test 'method';
1362 1360
 $dbi->helper(
1363
-    one => sub { 1 }
1361
+  one => sub { 1 }
1364 1362
 );
1365 1363
 $dbi->helper(
1366
-    two => sub { 2 }
1364
+  two => sub { 2 }
1367 1365
 );
1368 1366
 $dbi->method({
1369
-    twice => sub {
1370
-        my $self = shift;
1371
-        return $_[0] * 2;
1372
-    }
1367
+  twice => sub {
1368
+    my $self = shift;
1369
+    return $_[0] * 2;
1370
+  }
1373 1371
 });
1374 1372
 
1375 1373
 is($dbi->one, 1, "first");
... ...
@@ -1386,8 +1384,8 @@ $dbi->execute($create_table1);
1386 1384
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1387 1385
 $dbi->register_filter(three_times => sub { $_[0] * 3});
1388 1386
 $dbi->apply_filter(
1389
-    $table1, $key1 => {out => 'twice', in => 'three_times'}, 
1390
-              $key2 => {out => 'three_times', in => 'twice'});
1387
+  $table1, $key1 => {out => 'twice', in => 'three_times'}, 
1388
+            $key2 => {out => 'three_times', in => 'twice'});
1391 1389
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1392 1390
 $result = $dbi->execute("select * from $table1");
1393 1391
 $row   = $result->fetch_hash_one;
... ...
@@ -1407,10 +1405,10 @@ $dbi->execute($create_table1);
1407 1405
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1408 1406
 $dbi->register_filter(three_times => sub { $_[0] * 3});
1409 1407
 $dbi->apply_filter(
1410
-    $table1, $key1 => {out => 'twice', in => 'three_times'}, 
1411
-              $key2 => {out => 'three_times', in => 'twice'});
1408
+  $table1, $key1 => {out => 'twice', in => 'three_times'}, 
1409
+            $key2 => {out => 'three_times', in => 'twice'});
1412 1410
 $dbi->apply_filter(
1413
-    $table1, $key1 => {out => undef}
1411
+  $table1, $key1 => {out => undef}
1414 1412
 ); 
1415 1413
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1416 1414
 $result = $dbi->execute("select * from $table1");
... ...
@@ -1422,7 +1420,7 @@ eval { $dbi->execute("drop table $table1") };
1422 1420
 $dbi->execute($create_table1);
1423 1421
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1424 1422
 $dbi->apply_filter(
1425
-    $table1, $key1 => {out => 'twice', in => 'twice'}
1423
+  $table1, $key1 => {out => 'twice', in => 'twice'}
1426 1424
 );
1427 1425
 $dbi->insert({$key1 => 1, $key2 => 2},table => $table1, filter => {$key1 => undef});
1428 1426
 $dbi->update({$key1 => 2}, table => $table1, where => {$key2 => 2});
... ...
@@ -1435,7 +1433,7 @@ eval { $dbi->execute("drop table $table1") };
1435 1433
 $dbi->execute($create_table1);
1436 1434
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1437 1435
 $dbi->apply_filter(
1438
-    $table1, $key1 => {out => 'twice', in => 'twice'}
1436
+  $table1, $key1 => {out => 'twice', in => 'twice'}
1439 1437
 );
1440 1438
 $dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1=> undef});
1441 1439
 $dbi->delete(table => $table1, where => {$key1 => 1});
... ...
@@ -1448,7 +1446,7 @@ eval { $dbi->execute("drop table $table1") };
1448 1446
 $dbi->execute($create_table1);
1449 1447
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1450 1448
 $dbi->apply_filter(
1451
-    $table1, $key1 => {out => 'twice', in => 'twice'}
1449
+  $table1, $key1 => {out => 'twice', in => 'twice'}
1452 1450
 );
1453 1451
 $dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1454 1452
 $result = $dbi->select(table => $table1, where => {$key1 => 1});
... ...
@@ -1461,12 +1459,12 @@ eval { $dbi->execute("drop table $table1") };
1461 1459
 $dbi->execute($create_table1);
1462 1460
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1463 1461
 $dbi->apply_filter(
1464
-    $table1, $key1 => {out => 'twice', in => 'twice'}
1462
+  $table1, $key1 => {out => 'twice', in => 'twice'}
1465 1463
 );
1466 1464
 $dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1467 1465
 $result = $dbi->execute("select * from $table1 where $key1 = :$key1 and $key2 = :$key2",
1468
-                        {$key1 => 1, $key2 => 2},
1469
-                        table => [$table1]);
1466
+  {$key1 => 1, $key2 => 2},
1467
+  table => [$table1]);
1470 1468
 $rows   = $result->all;
1471 1469
 is_deeply($rows, [{$key1 => 4, $key2 => 2}], "execute");
1472 1470
 
... ...
@@ -1475,11 +1473,11 @@ eval { $dbi->execute("drop table $table1") };
1475 1473
 $dbi->execute($create_table1);
1476 1474
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1477 1475
 $dbi->apply_filter(
1478
-    $table1, $key1 => {out => 'twice', in => 'twice'}
1476
+  $table1, $key1 => {out => 'twice', in => 'twice'}
1479 1477
 );
1480 1478
 $dbi->insert({$key1 => 2, $key2 => 2}, table => $table1, filter => {$key1 => undef});
1481 1479
 $result = $dbi->execute("select * from {table $table1} where $key1 = :$key1 and $key2 = :$key2",
1482
-                        {$key1 => 1, $key2 => 2});
1480
+  {$key1 => 1, $key2 => 2});
1483 1481
 $rows   = $result->all;
1484 1482
 is_deeply($rows, [{$key1 => 4, $key2 => 2}], "execute table tag");
1485 1483
 
... ...
@@ -1491,26 +1489,26 @@ $dbi->execute($create_table2);
1491 1489
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1492 1490
 $dbi->register_filter(three_times => sub { $_[0] * 3 });
1493 1491
 $dbi->apply_filter(
1494
-    $table1, $key2 => {out => 'twice', in => 'twice'}
1492
+  $table1, $key2 => {out => 'twice', in => 'twice'}
1495 1493
 );
1496 1494
 $dbi->apply_filter(
1497
-    $table2, $key3 => {out => 'three_times', in => 'three_times'}
1495
+  $table2, $key3 => {out => 'three_times', in => 'three_times'}
1498 1496
 );
1499 1497
 $dbi->insert({$key1 => 5, $key2 => 2}, table => $table1, filter => {$key2 => undef});
1500 1498
 $dbi->insert({$key1 => 5, $key3 => 6}, table => $table2, filter => {$key3 => undef});
1501 1499
 $result = $dbi->select(
1502
-     table => [$table1, $table2],
1503
-     column => [$key2, $key3],
1504
-     where => {"$table1.$key2" => 1, "$table2.$key3" => 2}, relation => {"$table1.$key1" => "$table2.$key1"});
1500
+  table => [$table1, $table2],
1501
+  column => [$key2, $key3],
1502
+  where => {"$table1.$key2" => 1, "$table2.$key3" => 2}, relation => {"$table1.$key1" => "$table2.$key1"});
1505 1503
 
1506 1504
 $result->filter({$key2 => 'twice'});
1507 1505
 $rows   = $result->all;
1508 1506
 is_deeply($rows, [{$key2 => 4, $key3 => 18}], "select : join");
1509 1507
 
1510 1508
 $result = $dbi->select(
1511
-     table => [$table1, $table2],
1512
-     column => [$key2, $key3],
1513
-     where => {$key2 => 1, $key3 => 2}, relation => {"$table1.$key1" => "$table2.$key1"});
1509
+  table => [$table1, $table2],
1510
+  column => [$key2, $key3],
1511
+  where => {$key2 => 1, $key3 => 2}, relation => {"$table1.$key1" => "$table2.$key1"});
1514 1512
 
1515 1513
 $result->filter({$key2 => 'twice'});
1516 1514
 $rows   = $result->all;
... ...
@@ -1586,8 +1584,8 @@ is_deeply($row, {$key1 => 6, $key2 => 40});
1586 1584
 
1587 1585
 $dbi->register_filter(five_times => sub { $_[0] * 5 });
1588 1586
 $dbi->apply_filter($table1,
1589
-    $key1 => {end => sub { $_[0] * 3 } },
1590
-    $key2 => {end => 'five_times'}
1587
+  $key1 => {end => sub { $_[0] * 3 } },
1588
+  $key2 => {end => 'five_times'}
1591 1589
 );
1592 1590
 $result = $dbi->select(table => $table1);
1593 1591
 $result->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 });
... ...
@@ -1596,8 +1594,8 @@ is_deeply($row, {$key1 => 6, $key2 => 40}, 'apply_filter');
1596 1594
 
1597 1595
 $dbi->register_filter(five_times => sub { $_[0] * 5 });
1598 1596
 $dbi->apply_filter($table1,
1599
-    $key1 => {end => sub { $_[0] * 3 } },
1600
-    $key2 => {end => 'five_times'}
1597
+  $key1 => {end => sub { $_[0] * 3 } },
1598
+  $key2 => {end => 'five_times'}
1601 1599
 );
1602 1600
 $result = $dbi->select(table => $table1);
1603 1601
 $result->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 });
... ...
@@ -1620,11 +1618,11 @@ $dbi->execute($create_table1);
1620 1618
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1621 1619
 $result = $dbi->select(table => $table1);
1622 1620
 $row = $result
1623
-       ->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 })
1624
-       ->remove_filter
1625
-       ->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 })
1626
-       ->remove_end_filter
1627
-       ->fetch_one;
1621
+  ->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 })
1622
+  ->remove_filter
1623
+  ->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 })
1624
+  ->remove_end_filter
1625
+  ->fetch_one;
1628 1626
 is_deeply($row, [1, 2]);
1629 1627
 
1630 1628
 test 'empty where select';
... ...
@@ -1659,70 +1657,70 @@ $where = $dbi->where->clause(['and', "$key1 = :$key1", "$key2 = :$key2"]);
1659 1657
 is("$where", "where ( $key1 = :$key1 and $key2 = :$key2 )", 'no param');
1660 1658
 
1661 1659
 $where = $dbi->where
1662
-             ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1663
-             ->param({$key1 => 1});
1660
+  ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1661
+  ->param({$key1 => 1});
1664 1662
 
1665 1663
 $result = $dbi->select(
1666
-    table => $table1,
1667
-    where => $where
1664
+  table => $table1,
1665
+  where => $where
1668 1666
 );
1669 1667
 $row = $result->all;
1670 1668
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1671 1669
 
1672 1670
 $result = $dbi->select(
1673
-    table => $table1,
1674
-    where => [
1675
-        ['and', "$key1 = :$key1", "$key2 = :$key2"],
1676
-        {$key1 => 1}
1677
-    ]
1671
+  table => $table1,
1672
+  where => [
1673
+    ['and', "$key1 = :$key1", "$key2 = :$key2"],
1674
+    {$key1 => 1}
1675
+  ]
1678 1676
 );
1679 1677
 $row = $result->all;
1680 1678
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1681 1679
 
1682 1680
 $where = $dbi->where
1683
-             ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1684
-             ->param({$key1 => 1, $key2 => 2});
1681
+  ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1682
+  ->param({$key1 => 1, $key2 => 2});
1685 1683
 $result = $dbi->select(
1686
-    table => $table1,
1687
-    where => $where
1684
+  table => $table1,
1685
+  where => $where
1688 1686
 );
1689 1687
 $row = $result->all;
1690 1688
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1691 1689
 
1692 1690
 $where = $dbi->where
1693
-             ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1694
-             ->param({});
1691
+  ->clause(['and', "$key1 = :$key1", "$key2 = :$key2"])
1692
+  ->param({});
1695 1693
 $result = $dbi->select(
1696
-    table => $table1,
1697
-    where => $where,
1694
+  table => $table1,
1695
+  where => $where,
1698 1696
 );
1699 1697
 $row = $result->all;
1700 1698
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
1701 1699
 
1702 1700
 $where = $dbi->where
1703
-             ->clause(['and', ['or', "$key1 > :$key1", "$key1 < :$key1"], "$key2 = :$key2"])
1704
-             ->param({$key1 => [0, 3], $key2 => 2});
1701
+  ->clause(['and', ['or', "$key1 > :$key1", "$key1 < :$key1"], "$key2 = :$key2"])
1702
+  ->param({$key1 => [0, 3], $key2 => 2});
1705 1703
 $result = $dbi->select(
1706
-    table => $table1,
1707
-    where => $where,
1704
+  table => $table1,
1705
+  where => $where,
1708 1706
 ); 
1709 1707
 $row = $result->all;
1710 1708
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1711 1709
 
1712 1710
 $where = $dbi->where;
1713 1711
 $result = $dbi->select(
1714
-    table => $table1,
1715
-    where => $where
1712
+  table => $table1,
1713
+  where => $where
1716 1714
 );
1717 1715
 $row = $result->all;
1718 1716
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
1719 1717
 
1720 1718
 eval {
1721 1719
 $where = $dbi->where
1722
-             ->clause(['uuu']);
1720
+           ->clause(['uuu']);
1723 1721
 $result = $dbi->select(
1724
-    table => $table1,
1725
-    where => $where
1722
+  table => $table1,
1723
+  where => $where
1726 1724
 );
1727 1725
 };
1728 1726
 ok($@);
... ...
@@ -1731,170 +1729,170 @@ $where = $dbi->where;
1731 1729
 is("$where", '');
1732 1730
 
1733 1731
 $where = $dbi->where
1734
-             ->clause(['or', ("$key1 = :$key1") x 2])
1735
-             ->param({$key1 => [1, 3]});
1732
+  ->clause(['or', ("$key1 = :$key1") x 2])
1733
+  ->param({$key1 => [1, 3]});
1736 1734
 $result = $dbi->select(
1737
-    table => $table1,
1738
-    where => $where,
1735
+  table => $table1,
1736
+  where => $where,
1739 1737
 );
1740 1738
 $row = $result->all;
1741 1739
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
1742 1740
 
1743 1741
 $where = $dbi->where
1744
-             ->clause(['or', ("$key1 = :$key1") x 2])
1745
-             ->param({$key1 => [1]});
1742
+   ->clause(['or', ("$key1 = :$key1") x 2])
1743
+   ->param({$key1 => [1]});
1746 1744
 $result = $dbi->select(
1747
-    table => $table1,
1748
-    where => $where,
1745
+  table => $table1,
1746
+  where => $where,
1749 1747
 );
1750 1748
 $row = $result->all;
1751 1749
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1752 1750
 
1753 1751
 $where = $dbi->where
1754
-             ->clause(['or', ("$key1 = :$key1") x 2])
1755
-             ->param({$key1 => 1});
1752
+  ->clause(['or', ("$key1 = :$key1") x 2])
1753
+  ->param({$key1 => 1});
1756 1754
 $result = $dbi->select(
1757
-    table => $table1,
1758
-    where => $where,
1755
+  table => $table1,
1756
+  where => $where,
1759 1757
 );
1760 1758
 $row = $result->all;
1761 1759
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1762 1760
 
1763 1761
 $where = $dbi->where
1764
-             ->clause("$key1 = :$key1")
1765
-             ->param({$key1 => 1});
1762
+  ->clause("$key1 = :$key1")
1763
+  ->param({$key1 => 1});
1766 1764
 $result = $dbi->select(
1767
-    table => $table1,
1768
-    where => $where,
1765
+  table => $table1,
1766
+  where => $where,
1769 1767
 );
1770 1768
 $row = $result->all;
1771 1769
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1772 1770
 
1773 1771
 $where = $dbi->where
1774
-             ->clause(['or', ("$key1 = :$key1") x 3])
1775
-             ->param({$key1 => [$dbi->not_exists, 1, 3]});
1772
+  ->clause(['or', ("$key1 = :$key1") x 3])
1773
+  ->param({$key1 => [$dbi->not_exists, 1, 3]});
1776 1774
 $result = $dbi->select(
1777
-    table => $table1,
1778
-    where => $where,
1775
+  table => $table1,
1776
+  where => $where,
1779 1777
 );
1780 1778
 $row = $result->all;
1781 1779
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
1782 1780
 
1783 1781
 $where = $dbi->where
1784
-             ->clause(['or', ("$key1 = :$key1") x 3])
1785
-             ->param({$key1 => [1, $dbi->not_exists, 3]});
1782
+  ->clause(['or', ("$key1 = :$key1") x 3])
1783
+  ->param({$key1 => [1, $dbi->not_exists, 3]});
1786 1784
 $result = $dbi->select(
1787
-    table => $table1,
1788
-    where => $where,
1785
+  table => $table1,
1786
+  where => $where,
1789 1787
 );
1790 1788
 $row = $result->all;
1791 1789
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
1792 1790
 
1793 1791
 $where = $dbi->where
1794
-             ->clause(['or', ("$key1 = :$key1") x 3])
1795
-             ->param({$key1 => [1, 3, $dbi->not_exists]});
1792
+  ->clause(['or', ("$key1 = :$key1") x 3])
1793
+  ->param({$key1 => [1, 3, $dbi->not_exists]});
1796 1794
 $result = $dbi->select(
1797
-    table => $table1,
1798
-    where => $where,
1795
+  table => $table1,
1796
+  where => $where,
1799 1797
 );
1800 1798
 $row = $result->all;
1801 1799
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
1802 1800
 
1803 1801
 $where = $dbi->where
1804
-             ->clause(['or', ("$key1 = :$key1") x 3])
1805
-             ->param({$key1 => [1, $dbi->not_exists, $dbi->not_exists]});
1802
+  ->clause(['or', ("$key1 = :$key1") x 3])
1803
+  ->param({$key1 => [1, $dbi->not_exists, $dbi->not_exists]});
1806 1804
 $result = $dbi->select(
1807
-    table => $table1,
1808
-    where => $where,
1805
+  table => $table1,
1806
+  where => $where,
1809 1807
 );
1810 1808
 $row = $result->all;
1811 1809
 is_deeply($row, [{$key1 => 1, $key2 => 2}], 'not_exists');
1812 1810
 
1813 1811
 $where = $dbi->where
1814
-             ->clause(['or', ("$key1 = :$key1") x 3])
1815
-             ->param({$key1 => [$dbi->not_exists, 1, $dbi->not_exists]});
1812
+  ->clause(['or', ("$key1 = :$key1") x 3])
1813
+  ->param({$key1 => [$dbi->not_exists, 1, $dbi->not_exists]});
1816 1814
 $result = $dbi->select(
1817
-    table => $table1,
1818
-    where => $where,
1815
+  table => $table1,
1816
+  where => $where,
1819 1817
 );
1820 1818
 $row = $result->all;
1821 1819
 is_deeply($row, [{$key1 => 1, $key2 => 2}], 'not_exists');
1822 1820
 
1823 1821
 $where = $dbi->where
1824
-             ->clause(['or', ("$key1 = :$key1") x 3])
1825
-             ->param({$key1 => [$dbi->not_exists, $dbi->not_exists, 1]});
1822
+  ->clause(['or', ("$key1 = :$key1") x 3])
1823
+  ->param({$key1 => [$dbi->not_exists, $dbi->not_exists, 1]});
1826 1824
 $result = $dbi->select(
1827
-    table => $table1,
1828
-    where => $where,
1825
+  table => $table1,
1826
+  where => $where,
1829 1827
 );
1830 1828
 $row = $result->all;
1831 1829
 is_deeply($row, [{$key1 => 1, $key2 => 2}], 'not_exists');
1832 1830
 
1833 1831
 $where = $dbi->where
1834
-             ->clause(['or', ("$key1 = :$key1") x 3])
1835
-             ->param({$key1 => [$dbi->not_exists, $dbi->not_exists, $dbi->not_exists]});
1832
+  ->clause(['or', ("$key1 = :$key1") x 3])
1833
+  ->param({$key1 => [$dbi->not_exists, $dbi->not_exists, $dbi->not_exists]});
1836 1834
 $result = $dbi->select(
1837
-    table => $table1,
1838
-    where => $where,
1835
+  table => $table1,
1836
+  where => $where,
1839 1837
 );
1840 1838
 $row = $result->all;
1841 1839
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
1842 1840
 
1843 1841
 $where = $dbi->where
1844
-             ->clause(['or', ("$key1 = :$key1") x 3])
1845
-             ->param({$key1 => []});
1842
+  ->clause(['or', ("$key1 = :$key1") x 3])
1843
+  ->param({$key1 => []});
1846 1844
 $result = $dbi->select(
1847
-    table => $table1,
1848
-    where => $where,
1845
+  table => $table1,
1846
+  where => $where,
1849 1847
 );
1850 1848
 $row = $result->all;
1851 1849
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
1852 1850
 
1853 1851
 $where = $dbi->where
1854
-             ->clause(['and', "{> $key1}", "{< $key1}" ])
1855
-             ->param({$key1 => [2, $dbi->not_exists]});
1852
+  ->clause(['and', "{> $key1}", "{< $key1}" ])
1853
+  ->param({$key1 => [2, $dbi->not_exists]});
1856 1854
 $result = $dbi->select(
1857
-    table => $table1,
1858
-    where => $where,
1855
+  table => $table1,
1856
+  where => $where,
1859 1857
 );
1860 1858
 $row = $result->all;
1861 1859
 is_deeply($row, [{$key1 => 3, $key2 => 4}], 'not_exists');
1862 1860
 
1863 1861
 $where = $dbi->where
1864
-             ->clause(['and', "{> $key1}", "{< $key1}" ])
1865
-             ->param({$key1 => [$dbi->not_exists, 2]});
1862
+  ->clause(['and', "{> $key1}", "{< $key1}" ])
1863
+  ->param({$key1 => [$dbi->not_exists, 2]});
1866 1864
 $result = $dbi->select(
1867
-    table => $table1,
1868
-    where => $where,
1865
+  table => $table1,
1866
+  where => $where,
1869 1867
 );
1870 1868
 $row = $result->all;
1871 1869
 is_deeply($row, [{$key1 => 1, $key2 => 2}], 'not_exists');
1872 1870
 
1873 1871
 $where = $dbi->where
1874
-             ->clause(['and', "{> $key1}", "{< $key1}" ])
1875
-             ->param({$key1 => [$dbi->not_exists, $dbi->not_exists]});
1872
+  ->clause(['and', "{> $key1}", "{< $key1}" ])
1873
+  ->param({$key1 => [$dbi->not_exists, $dbi->not_exists]});
1876 1874
 $result = $dbi->select(
1877
-    table => $table1,
1878
-    where => $where,
1875
+  table => $table1,
1876
+  where => $where,
1879 1877
 );
1880 1878
 $row = $result->all;
1881 1879
 is_deeply($row, [{$key1 => 1, $key2 => 2},{$key1 => 3, $key2 => 4}], 'not_exists');
1882 1880
 
1883 1881
 $where = $dbi->where
1884
-             ->clause(['and', "{> $key1}", "{< $key1}" ])
1885
-             ->param({$key1 => [0, 2]});
1882
+  ->clause(['and', "{> $key1}", "{< $key1}" ])
1883
+  ->param({$key1 => [0, 2]});
1886 1884
 $result = $dbi->select(
1887
-    table => $table1,
1888
-    where => $where,
1885
+  table => $table1,
1886
+  where => $where,
1889 1887
 );
1890 1888
 $row = $result->all;
1891 1889
 is_deeply($row, [{$key1 => 1, $key2 => 2}], 'not_exists');
1892 1890
 
1893 1891
 $where = $dbi->where
1894
-             ->clause(['and',"$key1 is not null", "$key2 is not null" ]);
1892
+  ->clause(['and',"$key1 is not null", "$key2 is not null" ]);
1895 1893
 $result = $dbi->select(
1896
-    table => $table1,
1897
-    where => $where,
1894
+  table => $table1,
1895
+  where => $where,
1898 1896
 );
1899 1897
 $row = $result->all;
1900 1898
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], 'not_exists');
... ...
@@ -1903,24 +1901,24 @@ eval {$dbi->where(ppp => 1) };
1903 1901
 like($@, qr/invalid/);
1904 1902
 
1905 1903
 $where = $dbi->where(
1906
-    clause => ['and', ['or'], ['and', "$key1 = :$key1", "$key2 = :$key2"]],
1907
-    param => {$key1 => 1, $key2 => 2}
1904
+  clause => ['and', ['or'], ['and', "$key1 = :$key1", "$key2 = :$key2"]],
1905
+  param => {$key1 => 1, $key2 => 2}
1908 1906
 );
1909 1907
 $result = $dbi->select(
1910
-    table => $table1,
1911
-    where => $where,
1908
+  table => $table1,
1909
+  where => $where,
1912 1910
 );
1913 1911
 $row = $result->all;
1914 1912
 is_deeply($row, [{$key1 => 1, $key2 => 2}]);
1915 1913
 
1916 1914
 
1917 1915
 $where = $dbi->where(
1918
-    clause => ['and', ['or'], ['or', ":$key1", ":$key2"]],
1919
-    param => {}
1916
+  clause => ['and', ['or'], ['or', ":$key1", ":$key2"]],
1917
+  param => {}
1920 1918
 );
1921 1919
 $result = $dbi->select(
1922
-    table => $table1,
1923
-    where => $where,
1920
+  table => $table1,
1921
+  where => $where,
1924 1922
 );
1925 1923
 $row = $result->all;
1926 1924
 is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
... ...
@@ -1949,12 +1947,12 @@ $dbi->execute($create_table1);
1949 1947
 $dbi->insert({$key1 => 1, $key2 => '00:00:00'}, table => $table1);
1950 1948
 $dbi->insert({$key1 => 1, $key2 => '3'}, table => $table1);
1951 1949
 $where = $dbi->where
1952
-             ->clause(['and', "$key1 = :$key1", "$key2 = '00:00:00'"])
1953
-             ->param({$key1 => 1});
1950
+  ->clause(['and', "$key1 = :$key1", "$key2 = '00:00:00'"])
1951
+  ->param({$key1 => 1});
1954 1952
 
1955 1953
 $result = $dbi->select(
1956
-    table => $table1,
1957
-    where => $where
1954
+  table => $table1,
1955
+  where => $where
1958 1956
 );
1959 1957
 $row = $result->all;
1960 1958
 is_deeply($row, [{$key1 => 1, $key2 => '00:00:00'}]);
... ...
@@ -1962,14 +1960,14 @@ is_deeply($row, [{$key1 => 1, $key2 => '00:00:00'}]);
1962 1960
 test 'register_tag_processor';
1963 1961
 $dbi = DBIx::Custom->connect;
1964 1962
 $dbi->register_tag_processor(
1965
-    a => sub { 1 }
1963
+  a => sub { 1 }
1966 1964
 );
1967 1965
 is($dbi->{_tags}->{a}->(), 1);
1968 1966
 
1969 1967
 test 'register_tag';
1970 1968
 $dbi = DBIx::Custom->connect;
1971 1969
 $dbi->register_tag(
1972
-    b => sub { 2 }
1970
+  b => sub { 2 }
1973 1971
 );
1974 1972
 is($dbi->{_tags}->{b}->(), 2);
1975 1973
 
... ...
@@ -1995,7 +1993,7 @@ $dbi->execute($create_table1);
1995 1993
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
1996 1994
 $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
1997 1995
 $dbi->apply_filter($table1, $key2, 
1998
-                   {in => sub { $_[0] * 3 }, out => sub { $_[0] * 2 }});
1996
+                 {in => sub { $_[0] * 3 }, out => sub { $_[0] * 2 }});
1999 1997
 $rows = $dbi->select(table => $table1, where => {$key2 => 1})->all;
2000 1998
 is_deeply($rows, [{$key1 => 1, $key2 => 6}]);
2001 1999
 
... ...
@@ -2024,11 +2022,11 @@ eval { $dbi->execute("drop table $table1") };
2024 2022
 $dbi->execute($create_table1);
2025 2023
 $dbi->register_filter(twice => sub { $_[0] * 2 });
2026 2024
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
2027
-             filter => {$key1 => 'twice'});
2025
+           filter => {$key1 => 'twice'});
2028 2026
 $row = $dbi->select(table => $table1)->one;
2029 2027
 is_deeply($row, {$key1 => 2, $key2 => 2});
2030 2028
 eval {$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
2031
-             filter => {$key1 => 'no'}) };
2029
+           filter => {$key1 => 'no'}) };
2032 2030
 like($@, qr//);
2033 2031
 
2034 2032
 $dbi->register_filter(one => sub { });
... ...
@@ -2081,17 +2079,17 @@ eval { $dbi->execute("drop table $table1") };
2081 2079
 $dbi->execute($create_table1_2);
2082 2080
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2083 2081
 $dbi->delete_at(
2084
-    table => $table1,
2085
-    primary_key => [$key1, $key2],
2086
-    where => [1, 2],
2082
+  table => $table1,
2083
+  primary_key => [$key1, $key2],
2084
+  where => [1, 2],
2087 2085
 );
2088 2086
 is_deeply($dbi->select(table => $table1)->all, []);
2089 2087
 
2090 2088
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2091 2089
 $dbi->delete_at(
2092
-    table => $table1,
2093
-    primary_key => $key1,
2094
-    where => 1,
2090
+  table => $table1,
2091
+  primary_key => $key1,
2092
+  where => 1,
2095 2093
 );
2096 2094
 is_deeply($dbi->select(table => $table1)->all, []);
2097 2095
 
... ...
@@ -2100,10 +2098,10 @@ $dbi = DBIx::Custom->connect;
2100 2098
 eval { $dbi->execute("drop table $table1") };
2101 2099
 $dbi->execute($create_table1_2);
2102 2100
 $dbi->insert_at(
2103
-    {$key3 => 3},
2104
-    primary_key => [$key1, $key2], 
2105
-    table => $table1,
2106
-    where => [1, 2],
2101
+  {$key3 => 3},
2102
+  primary_key => [$key1, $key2], 
2103
+  table => $table1,
2104
+  where => [1, 2],
2107 2105
 );
2108 2106
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2109 2107
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2112,10 +2110,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 3);
2112 2110
 $dbi->delete_all(table => $table1);
2113 2111
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2114 2112
 $dbi->insert_at(
2115
-    {$key2 => 2, $key3 => 3},
2116
-    primary_key => $key1, 
2117
-    table => $table1,
2118
-    where => 1,
2113
+  {$key2 => 2, $key3 => 3},
2114
+  primary_key => $key1, 
2115
+  table => $table1,
2116
+  where => 1,
2119 2117
 );
2120 2118
 
2121 2119
 is($dbi->select(table => $table1)->one->{$key1}, 1);
... ...
@@ -2126,10 +2124,10 @@ $dbi = DBIx::Custom->connect;
2126 2124
 eval { $dbi->execute("drop table $table1") };
2127 2125
 $dbi->execute($create_table1_2);
2128 2126
 $dbi->insert_at(
2129
-    {$key3 => 3},
2130
-    primary_key => [$key1, $key2], 
2131
-    table => $table1,
2132
-    where => [1, 2],
2127
+  {$key3 => 3},
2128
+  primary_key => [$key1, $key2], 
2129
+  table => $table1,
2130
+  where => [1, 2],
2133 2131
 );
2134 2132
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2135 2133
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2141,10 +2139,10 @@ eval { $dbi->execute("drop table $table1") };
2141 2139
 $dbi->execute($create_table1_2);
2142 2140
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2143 2141
 $dbi->update_at(
2144
-    {$key3 => 4},
2145
-    table => $table1,
2146
-    primary_key => [$key1, $key2],
2147
-    where => [1, 2],
2142
+  {$key3 => 4},
2143
+  table => $table1,
2144
+  primary_key => [$key1, $key2],
2145
+  where => [1, 2],
2148 2146
 );
2149 2147
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2150 2148
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2153,10 +2151,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 4);
2153 2151
 $dbi->delete_all(table => $table1);
2154 2152
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2155 2153
 $dbi->update_at(
2156
-    {$key3 => 4},
2157
-    table => $table1,
2158
-    primary_key => $key1,
2159
-    where => 1,
2154
+  {$key3 => 4},
2155
+  table => $table1,
2156
+  primary_key => $key1,
2157
+  where => 1,
2160 2158
 );
2161 2159
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2162 2160
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2167,10 +2165,10 @@ eval { $dbi->execute("drop table $table1") };
2167 2165
 $dbi->execute($create_table1_2);
2168 2166
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2169 2167
 $dbi->update_at(
2170
-    {$key3 => 4},
2171
-    table => $table1,
2172
-    primary_key => [$key1, $key2],
2173
-    where => [1, 2]
2168
+  {$key3 => 4},
2169
+  table => $table1,
2170
+  primary_key => [$key1, $key2],
2171
+  where => [1, 2]
2174 2172
 );
2175 2173
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2176 2174
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2182,9 +2180,9 @@ eval { $dbi->execute("drop table $table1") };
2182 2180
 $dbi->execute($create_table1_2);
2183 2181
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2184 2182
 $result = $dbi->select_at(
2185
-    table => $table1,
2186
-    primary_key => [$key1, $key2],
2187
-    where => [1, 2]
2183
+  table => $table1,
2184
+  primary_key => [$key1, $key2],
2185
+  where => [1, 2]
2188 2186
 );
2189 2187
 $row = $result->one;
2190 2188
 is($row->{$key1}, 1);
... ...
@@ -2194,9 +2192,9 @@ is($row->{$key3}, 3);
2194 2192
 $dbi->delete_all(table => $table1);
2195 2193
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2196 2194
 $result = $dbi->select_at(
2197
-    table => $table1,
2198
-    primary_key => $key1,
2199
-    where => 1,
2195
+  table => $table1,
2196
+  primary_key => $key1,
2197
+  where => 1,
2200 2198
 );
2201 2199
 $row = $result->one;
2202 2200
 is($row->{$key1}, 1);
... ...
@@ -2206,9 +2204,9 @@ is($row->{$key3}, 3);
2206 2204
 $dbi->delete_all(table => $table1);
2207 2205
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2208 2206
 $result = $dbi->select_at(
2209
-    table => $table1,
2210
-    primary_key => [$key1, $key2],
2211
-    where => [1, 2]
2207
+  table => $table1,
2208
+  primary_key => [$key1, $key2],
2209
+  where => [1, 2]
2212 2210
 );
2213 2211
 $row = $result->one;
2214 2212
 is($row->{$key1}, 1);
... ...
@@ -2238,8 +2236,8 @@ $dbi = MyDBI6->connect;
2238 2236
 eval { $dbi->execute("drop table $table1") };
2239 2237
 $dbi->execute($create_table1_2);
2240 2238
 $dbi->model($table1)->insert_at(
2241
-    {$key3 => 3},
2242
-    where => [1, 2],
2239
+  {$key3 => 3},
2240
+  where => [1, 2],
2243 2241
 );
2244 2242
 $result = $dbi->model($table1)->select;
2245 2243
 $row = $result->one;
... ...
@@ -2253,8 +2251,8 @@ eval { $dbi->execute("drop table $table1") };
2253 2251
 $dbi->execute($create_table1_2);
2254 2252
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2255 2253
 $dbi->model($table1)->update_at(
2256
-    {$key3 => 4},
2257
-    where => [1, 2],
2254
+  {$key3 => 4},
2255
+  where => [1, 2],
2258 2256
 );
2259 2257
 $result = $dbi->model($table1)->select;
2260 2258
 $row = $result->one;
... ...
@@ -2287,11 +2285,11 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2287 2285
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
2288 2286
 $model = $dbi->model($table1);
2289 2287
 $result = $model->select(
2290
-    column => [$model->mycolumn, $model->column($table2)],
2291
-    where => {"$table1.$key1" => 1}
2288
+  column => [$model->mycolumn, $model->column($table2)],
2289
+  where => {"$table1.$key1" => 1}
2292 2290
 );
2293 2291
 is_deeply($result->one,
2294
-          {$key1 => 1, $key2 => 2, "${table2}__$key1" => 1, "${table2}__$key3" => 3});
2292
+        {$key1 => 1, $key2 => 2, "${table2}__$key1" => 1, "${table2}__$key3" => 3});
2295 2293
 
2296 2294
 test 'values_clause';
2297 2295
 $dbi = DBIx::Custom->connect;
... ...
@@ -2330,62 +2328,62 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2330 2328
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
2331 2329
 $model = $dbi->model($table1);
2332 2330
 $result = $model->select_at(
2333
-    column => [
2334
-        $model->mycolumn,
2335
-        $model->column($table2)
2336
-    ]
2331
+  column => [
2332
+    $model->mycolumn,
2333
+    $model->column($table2)
2334
+  ]
2337 2335
 );
2338 2336
 is_deeply($result->one,
2339
-          {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
2337
+  {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
2340 2338
 
2341 2339
 $result = $model->select_at(
2342
-    column => [
2343
-        $model->mycolumn([$key1]),
2344
-        $model->column($table2 => [$key1])
2345
-    ]
2340
+  column => [
2341
+    $model->mycolumn([$key1]),
2342
+    $model->column($table2 => [$key1])
2343
+  ]
2346 2344
 );
2347 2345
 is_deeply($result->one,
2348
-          {$key1 => 1, "$table2.$key1" => 1});
2346
+        {$key1 => 1, "$table2.$key1" => 1});
2349 2347
 $result = $model->select_at(
2350
-    column => [
2351
-        $model->mycolumn([$key1]),
2352
-        {$table2 => [$key1]}
2353
-    ]
2348
+  column => [
2349
+    $model->mycolumn([$key1]),
2350
+    {$table2 => [$key1]}
2351
+  ]
2354 2352
 );
2355 2353
 is_deeply($result->one,
2356
-          {$key1 => 1, "$table2.$key1" => 1});
2354
+        {$key1 => 1, "$table2.$key1" => 1});
2357 2355
 
2358 2356
 $result = $model->select_at(
2359
-    column => [
2360
-        $model->mycolumn([$key1]),
2361
-        ["$table2.$key1", as => "$table2.$key1"]
2362
-    ]
2357
+  column => [
2358
+    $model->mycolumn([$key1]),
2359
+    ["$table2.$key1", as => "$table2.$key1"]
2360
+  ]
2363 2361
 );
2364 2362
 is_deeply($result->one,
2365
-          {$key1 => 1, "$table2.$key1" => 1});
2363
+  {$key1 => 1, "$table2.$key1" => 1});
2366 2364
 
2367 2365
 $result = $model->select_at(
2368
-    column => [
2369
-        $model->mycolumn([$key1]),
2370
-        ["$table2.$key1" => "$table2.$key1"]
2371
-    ]
2366
+  column => [
2367
+    $model->mycolumn([$key1]),
2368
+    ["$table2.$key1" => "$table2.$key1"]
2369
+  ]
2372 2370
 );
2373 2371
 is_deeply($result->one,
2374
-          {$key1 => 1, "$table2.$key1" => 1});
2372
+  {$key1 => 1, "$table2.$key1" => 1});
2375 2373
 
2376 2374
 test 'merge_param';
2377 2375
 $dbi = DBIx::Custom->new;
2378 2376
 $params = [
2379
-    {$key1 => 1, $key2 => 2, $key3 => 3},
2380
-    {$key1 => 1, $key2 => 2},
2381
-    {$key1 => 1}
2377
+  {$key1 => 1, $key2 => 2, $key3 => 3},
2378
+  {$key1 => 1, $key2 => 2},
2379
+  {$key1 => 1}
2382 2380
 ];
2383 2381
 $param = $dbi->merge_param($params->[0], $params->[1], $params->[2]);
2384 2382
 is_deeply($param, {$key1 => [1, 1, 1], $key2 => [2, 2], $key3 => 3});
2385 2383
 
2386 2384
 $params = [
2387
-    {$key1 => [1, 2], $key2 => 1, $key3 => [1, 2]},
2388
-    {$key1 => [3, 4], $key2 => [2, 3], $key3 => 3}
2385
+  {$key1 => [1, 2], $key2 => 1, $key3 => [1, 2]},
2386
+  {$key1 => [3, 4], $key2 => [2, 3], $key3 => 3}
2389 2387
 ];
2390 2388
 $param = $dbi->merge_param($params->[0], $params->[1]);
2391 2389
 is_deeply($param, {$key1 => [1, 2, 3, 4], $key2 => [1, 2, 3], $key3 => [1, 2, 3]});
... ...
@@ -2401,22 +2399,22 @@ $dbi->execute($create_table2);
2401 2399
 $dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
2402 2400
 $dbi->insert({$key1 => 2, $key3 => 5}, table => $table2);
2403 2401
 $rows = $dbi->select(
2404
-    table => $table1,
2405
-    column => "$table1.$key1 as ${table1}_$key1, $key2, $key3",
2406
-    where   => {"$table1.$key2" => 3},
2407
-    join  => ["inner join (select * from $table2 where {= $table2.$key3})" . 
2408
-              " $table2 on $table1.$key1 = $table2.$key1"],
2409
-    param => {"$table2.$key3" => 5}
2402
+  table => $table1,
2403
+  column => "$table1.$key1 as ${table1}_$key1, $key2, $key3",
2404
+  where   => {"$table1.$key2" => 3},
2405
+  join  => ["inner join (select * from $table2 where {= $table2.$key3})" . 
2406
+            " $table2 on $table1.$key1 = $table2.$key1"],
2407
+  param => {"$table2.$key3" => 5}
2410 2408
 )->all;
2411 2409
 is_deeply($rows, [{"${table1}_$key1" => 2, $key2 => 3, $key3 => 5}]);
2412 2410
 
2413 2411
 $rows = $dbi->select(
2414
-    table => $table1,
2415
-    column => "$table1.$key1 as ${table1}_$key1, $key2, $key3",
2416
-    where   => {"$table1.$key2" => 3},
2417
-    join  => "inner join (select * from $table2 where {= $table2.$key3})" . 
2418
-             " $table2 on $table1.$key1 = $table2.$key1",
2419
-    param => {"$table2.$key3" => 5}
2412
+  table => $table1,
2413
+  column => "$table1.$key1 as ${table1}_$key1, $key2, $key3",
2414
+  where   => {"$table1.$key2" => 3},
2415
+  join  => "inner join (select * from $table2 where {= $table2.$key3})" . 
2416
+           " $table2 on $table1.$key1 = $table2.$key1",
2417
+  param => {"$table2.$key3" => 5}
2420 2418
 )->all;
2421 2419
 is_deeply($rows, [{"${table1}_$key1" => 2, $key2 => 3, $key3 => 5}]);
2422 2420
 
... ...
@@ -2427,9 +2425,9 @@ $dbi->execute($create_table1);
2427 2425
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2428 2426
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
2429 2427
 $rows = $dbi->select(
2430
-    table => $table1,
2431
-    where => "$key1 = :$key1 and $key2 = :$key2",
2432
-    where_param => {$key1 => 1, $key2 => 2}
2428
+  table => $table1,
2429
+  where => "$key1 = :$key1 and $key2 = :$key2",
2430
+  where_param => {$key1 => 1, $key2 => 2}
2433 2431
 )->all;
2434 2432
 is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
2435 2433
 
... ...
@@ -2439,11 +2437,11 @@ $dbi->execute($create_table1);
2439 2437
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2440 2438
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
2441 2439
 $rows = $dbi->select(
2442
-    table => $table1,
2443
-    where => [
2444
-        "$key1 = :$key1 and $key2 = :$key2",
2445
-        {$key1 => 1, $key2 => 2}
2446
-    ]
2440
+  table => $table1,
2441
+  where => [
2442
+    "$key1 = :$key1 and $key2 = :$key2",
2443
+    {$key1 => 1, $key2 => 2}
2444
+  ]
2447 2445
 )->all;
2448 2446
 is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
2449 2447
 
... ...
@@ -2453,11 +2451,11 @@ $dbi->execute($create_table1);
2453 2451
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2454 2452
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
2455 2453
 $rows = $dbi->select(
2456
-    table => $table1,
2457
-    where => [
2458
-        "$key1 = :$key1 and $key2 = :$key2",
2459
-        {$key1 => 1, $key2 => 2}
2460
-    ]
2454
+  table => $table1,
2455
+  where => [
2456
+    "$key1 = :$key1 and $key2 = :$key2",
2457
+    {$key1 => 1, $key2 => 2}
2458
+  ]
2461 2459
 )->all;
2462 2460
 is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
2463 2461
 
... ...
@@ -2468,9 +2466,9 @@ $dbi->execute($create_table1);
2468 2466
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2469 2467
 $dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
2470 2468
 $dbi->delete(
2471
-    table => $table1,
2472
-    where => "$key1 = :$key1 and $key2 = :$key2",
2473
-    where_param => {$key1 => 1, $key2 => 2}
2469
+  table => $table1,
2470
+  where => "$key1 = :$key1 and $key2 = :$key2",
2471
+  where_param => {$key1 => 1, $key2 => 2}
2474 2472
 );
2475 2473
 $rows = $dbi->select(table => $table1)->all;
2476 2474
 is_deeply($rows, [{$key1 => 2, $key2 => 3}]);
... ...
@@ -2481,11 +2479,11 @@ $dbi->execute($create_table1);
2481 2479
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2482 2480
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
2483 2481
 $dbi->delete(
2484
-    table => $table1,
2485
-    where => [
2486
-        "$key1 = :$key1 and $key2 = :$key2",
2487
-         {$key1 => 1, $key2 => 2}
2488
-    ]
2482
+  table => $table1,
2483
+  where => [
2484
+    "$key1 = :$key1 and $key2 = :$key2",
2485
+     {$key1 => 1, $key2 => 2}
2486
+  ]
2489 2487
 );
2490 2488
 $rows = $dbi->select(table => $table1)->all;
2491 2489
 is_deeply($rows, [{$key1 => 2, $key2 => 3}]);
... ...
@@ -2497,10 +2495,10 @@ eval { $dbi->execute("drop table $table1") };
2497 2495
 $dbi->execute($create_table1);
2498 2496
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2499 2497
 $dbi->update(
2500
-    {$key1 => 5},
2501
-    table => $table1,
2502
-    where => "$key1 = :$key1 and $key2 = :$key2",
2503
-    where_param => {$key1 => 1, $key2 => 2}
2498
+  {$key1 => 5},
2499
+  table => $table1,
2500
+  where => "$key1 = :$key1 and $key2 = :$key2",
2501
+  where_param => {$key1 => 1, $key2 => 2}
2504 2502
 );
2505 2503
 $rows = $dbi->select(table => $table1)->all;
2506 2504
 is_deeply($rows, [{$key1 => 5, $key2 => 2}]);
... ...
@@ -2510,12 +2508,12 @@ eval { $dbi->execute("drop table $table1") };
2510 2508
 $dbi->execute($create_table1);
2511 2509
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2512 2510
 $dbi->update(
2513
-    {$key1 => 5},
2514
-    table => $table1,
2515
-    where => [
2516
-        "$key1 = :$key1 and $key2 = :$key2",
2517
-        {$key1 => 1, $key2 => 2}
2518
-    ]
2511
+  {$key1 => 5},
2512
+  table => $table1,
2513
+  where => [
2514
+    "$key1 = :$key1 and $key2 = :$key2",
2515
+    {$key1 => 1, $key2 => 2}
2516
+  ]
2519 2517
 );
2520 2518
 $rows = $dbi->select(table => $table1)->all;
2521 2519
 is_deeply($rows, [{$key1 => 5, $key2 => 2}]);
... ...
@@ -2525,10 +2523,10 @@ $dbi = DBIx::Custom->connect;
2525 2523
 eval { $dbi->execute("drop table $table1") };
2526 2524
 $dbi->execute($create_table1_2);
2527 2525
 $dbi->insert(
2528
-    {$key3 => 3},
2529
-    primary_key => [$key1, $key2], 
2530
-    table => $table1,
2531
-    id => [1, 2],
2526
+  {$key3 => 3},
2527
+  primary_key => [$key1, $key2], 
2528
+  table => $table1,
2529
+  id => [1, 2],
2532 2530
 );
2533 2531
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2534 2532
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2536,10 +2534,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 3);
2536 2534
 
2537 2535
 $dbi->delete_all(table => $table1);
2538 2536
 $dbi->insert(
2539
-    {$key2 => 2, $key3 => 3},
2540
-    primary_key => $key1, 
2541
-    table => $table1,
2542
-    id => 0,
2537
+  {$key2 => 2, $key3 => 3},
2538
+  primary_key => $key1, 
2539
+  table => $table1,
2540
+  id => 0,
2543 2541
 );
2544 2542
 
2545 2543
 is($dbi->select(table => $table1)->one->{$key1}, 0);
... ...
@@ -2550,10 +2548,10 @@ $dbi = DBIx::Custom->connect;
2550 2548
 eval { $dbi->execute("drop table $table1") };
2551 2549
 $dbi->execute($create_table1_2);
2552 2550
 $dbi->insert(
2553
-    {$key3 => 3},
2554
-    primary_key => [$key1, $key2], 
2555
-    table => $table1,
2556
-    id => 1,
2551
+  {$key3 => 3},
2552
+  primary_key => [$key1, $key2], 
2553
+  table => $table1,
2554
+  id => 1,
2557 2555
 );
2558 2556
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2559 2557
 ok(!$dbi->select(table => $table1)->one->{$key2});
... ...
@@ -2563,10 +2561,10 @@ $dbi = DBIx::Custom->connect;
2563 2561
 eval { $dbi->execute("drop table $table1") };
2564 2562
 $dbi->execute($create_table1_2);
2565 2563
 $dbi->insert(
2566
-    {$key3 => 3},
2567
-    primary_key => [$key1, $key2], 
2568
-    table => $table1,
2569
-    id => [1, 2],
2564
+  {$key3 => 3},
2565
+  primary_key => [$key1, $key2], 
2566
+  table => $table1,
2567
+  id => [1, 2],
2570 2568
 );
2571 2569
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2572 2570
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2577,10 +2575,10 @@ eval { $dbi->execute("drop table $table1") };
2577 2575
 $dbi->execute($create_table1_2);
2578 2576
 $param = {$key3 => 3, $key2 => 4};
2579 2577
 $dbi->insert(
2580
-    $param,
2581
-    primary_key => [$key1, $key2], 
2582
-    table => $table1,
2583
-    id => [1, 2],
2578
+  $param,
2579
+  primary_key => [$key1, $key2], 
2580
+  table => $table1,
2581
+  id => [1, 2],
2584 2582
 );
2585 2583
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2586 2584
 is($dbi->select(table => $table1)->one->{$key2}, 4);
... ...
@@ -2592,11 +2590,11 @@ eval { $dbi->execute("drop table $table1") };
2592 2590
 $dbi->execute($create_table1_2);
2593 2591
 $param = {$key3 => 3, $key2 => 4};
2594 2592
 $query = $dbi->insert(
2595
-    $param,
2596
-    primary_key => [$key1, $key2], 
2597
-    table => $table1,
2598
-    id => [1, 2],
2599
-    query => 1
2593
+  $param,
2594
+  primary_key => [$key1, $key2], 
2595
+  table => $table1,
2596
+  id => [1, 2],
2597
+  query => 1
2600 2598
 );
2601 2599
 ok(ref $query);
2602 2600
 is_deeply($param, {$key3 => 3, $key2 => 4});
... ...
@@ -2606,8 +2604,8 @@ $dbi = MyDBI6->connect;
2606 2604
 eval { $dbi->execute("drop table $table1") };
2607 2605
 $dbi->execute($create_table1_2);
2608 2606
 $dbi->model($table1)->insert(
2609
-    {$key3 => 3},
2610
-    id => [1, 2],
2607
+  {$key3 => 3},
2608
+  id => [1, 2],
2611 2609
 );
2612 2610
 $result = $dbi->model($table1)->select;
2613 2611
 $row = $result->one;
... ...
@@ -2619,8 +2617,8 @@ $dbi = MyDBI6->connect;
2619 2617
 eval { $dbi->execute("drop table $table1") };
2620 2618
 $dbi->execute($create_table1_2);
2621 2619
 $dbi->model($table1)->insert(
2622
-    {$key3 => 3},
2623
-    id => [1, 2]
2620
+  {$key3 => 3},
2621
+  id => [1, 2]
2624 2622
 );
2625 2623
 $result = $dbi->model($table1)->select;
2626 2624
 $row = $result->one;
... ...
@@ -2634,10 +2632,10 @@ eval { $dbi->execute("drop table $table1") };
2634 2632
 $dbi->execute($create_table1_2);
2635 2633
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2636 2634
 $dbi->update(
2637
-    {$key3 => 4},
2638
-    table => $table1,
2639
-    primary_key => [$key1, $key2],
2640
-    id => [1, 2],
2635
+  {$key3 => 4},
2636
+  table => $table1,
2637
+  primary_key => [$key1, $key2],
2638
+  id => [1, 2],
2641 2639
 );
2642 2640
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2643 2641
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2646,10 +2644,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 4);
2646 2644
 $dbi->delete_all(table => $table1);
2647 2645
 $dbi->insert({$key1 => 0, $key2 => 2, $key3 => 3}, table => $table1);
2648 2646
 $dbi->update(
2649
-    {$key3 => 4},
2650
-    table => $table1,
2651
-    primary_key => $key1,
2652
-    id => 0,
2647
+  {$key3 => 4},
2648
+  table => $table1,
2649
+  primary_key => $key1,
2650
+  id => 0,
2653 2651
 );
2654 2652
 is($dbi->select(table => $table1)->one->{$key1}, 0);
2655 2653
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2660,10 +2658,10 @@ eval { $dbi->execute("drop table $table1") };
2660 2658
 $dbi->execute($create_table1_2);
2661 2659
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2662 2660
 $dbi->update(
2663
-    {$key3 => 4},
2664
-    table => $table1,
2665
-    primary_key => [$key1, $key2],
2666
-    id => [1, 2]
2661
+  {$key3 => 4},
2662
+  table => $table1,
2663
+  primary_key => [$key1, $key2],
2664
+  id => [1, 2]
2667 2665
 );
2668 2666
 is($dbi->select(table => $table1)->one->{$key1}, 1);
2669 2667
 is($dbi->select(table => $table1)->one->{$key2}, 2);
... ...
@@ -2676,8 +2674,8 @@ eval { $dbi->execute("drop table $table1") };
2676 2674
 $dbi->execute($create_table1_2);
2677 2675
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2678 2676
 $dbi->model($table1)->update(
2679
-    {$key3 => 4},
2680
-    id => [1, 2],
2677
+  {$key3 => 4},
2678
+  id => [1, 2],
2681 2679
 );
2682 2680
 $result = $dbi->model($table1)->select;
2683 2681
 $row = $result->one;
... ...
@@ -2692,17 +2690,17 @@ eval { $dbi->execute("drop table $table1") };
2692 2690
 $dbi->execute($create_table1_2);
2693 2691
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2694 2692
 $dbi->delete(
2695
-    table => $table1,
2696
-    primary_key => [$key1, $key2],
2697
-    id => [1, 2],
2693
+  table => $table1,
2694
+  primary_key => [$key1, $key2],
2695
+  id => [1, 2],
2698 2696
 );
2699 2697
 is_deeply($dbi->select(table => $table1)->all, []);
2700 2698
 
2701 2699
 $dbi->insert({$key1 => 0, $key2 => 2, $key3 => 3}, table => $table1);
2702 2700
 $dbi->delete(
2703
-    table => $table1,
2704
-    primary_key => $key1,
2705
-    id => 0,
2701
+  table => $table1,
2702
+  primary_key => $key1,
2703
+  id => 0,
2706 2704
 );
2707 2705
 is_deeply($dbi->select(table => $table1)->all, []);
2708 2706
 
... ...
@@ -2732,9 +2730,9 @@ eval { $dbi->execute("drop table $table1") };
2732 2730
 $dbi->execute($create_table1_2);
2733 2731
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2734 2732
 $result = $dbi->select(
2735
-    table => $table1,
2736
-    primary_key => [$key1, $key2],
2737
-    id => [1, 2]
2733
+  table => $table1,
2734
+  primary_key => [$key1, $key2],
2735
+  id => [1, 2]
2738 2736
 );
2739 2737
 $row = $result->one;
2740 2738
 is($row->{$key1}, 1);
... ...
@@ -2744,9 +2742,9 @@ is($row->{$key3}, 3);
2744 2742
 $dbi->delete_all(table => $table1);
2745 2743
 $dbi->insert({$key1 => 0, $key2 => 2, $key3 => 3}, table => $table1);
2746 2744
 $result = $dbi->select(
2747
-    table => $table1,
2748
-    primary_key => $key1,
2749
-    id => 0,
2745
+  table => $table1,
2746
+  primary_key => $key1,
2747
+  id => 0,
2750 2748
 );
2751 2749
 $row = $result->one;
2752 2750
 is($row->{$key1}, 0);
... ...
@@ -2756,9 +2754,9 @@ is($row->{$key3}, 3);
2756 2754
 $dbi->delete_all(table => $table1);
2757 2755
 $dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
2758 2756
 $result = $dbi->select(
2759
-    table => $table1,
2760
-    primary_key => [$key1, $key2],
2761
-    id => [1, 2]
2757
+  table => $table1,
2758
+  primary_key => [$key1, $key2],
2759
+  id => [1, 2]
2762 2760
 );
2763 2761
 $row = $result->one;
2764 2762
 is($row->{$key1}, 1);
... ...
@@ -2789,18 +2787,18 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2789 2787
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
2790 2788
 $model = $dbi->model($table1);
2791 2789
 $result = $model->select(
2792
-    column => [$model->column($table2)],
2793
-    where => {"$table1.$key1" => 1}
2790
+  column => [$model->column($table2)],
2791
+  where => {"$table1.$key1" => 1}
2794 2792
 );
2795 2793
 is_deeply($result->one,
2796
-          {"$table2.$key1" => 1, "$table2.$key3" => 3});
2794
+        {"$table2.$key1" => 1, "$table2.$key3" => 3});
2797 2795
 
2798 2796
 $result = $model->select(
2799
-    column => [$model->column($table2 => [$key1, $key3])],
2800
-    where => {"$table1.$key1" => 1}
2797
+  column => [$model->column($table2 => [$key1, $key3])],
2798
+  where => {"$table1.$key1" => 1}
2801 2799
 );
2802 2800
 is_deeply($result->one,
2803
-          {"$table2.$key1" => 1, "$table2.$key3" => 3});
2801
+        {"$table2.$key1" => 1, "$table2.$key3" => 3});
2804 2802
 
2805 2803
 test 'separator';
2806 2804
 $dbi = DBIx::Custom->connect;
... ...
@@ -2811,54 +2809,54 @@ $dbi->execute($create_table1);
2811 2809
 $dbi->execute($create_table2);
2812 2810
 
2813 2811
 $dbi->create_model(
2814
-    table => $table1,
2815
-    join => [
2816
-       "left outer join $table2 on $table1.$key1 = $table2.$key1"
2817
-    ],
2818
-    primary_key => [$key1],
2812
+  table => $table1,
2813
+  join => [
2814
+   "left outer join $table2 on $table1.$key1 = $table2.$key1"
2815
+  ],
2816
+  primary_key => [$key1],
2819 2817
 );
2820 2818
 $model2 = $dbi->create_model(
2821
-    table => $table2,
2819
+  table => $table2,
2822 2820
 );
2823 2821
 $dbi->setup_model;
2824 2822
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
2825 2823
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
2826 2824
 $model = $dbi->model($table1);
2827 2825
 $result = $model->select(
2828
-    column => [
2829
-        $model->mycolumn,
2830
-        {$table2 => [$key1, $key3]}
2831
-    ],
2832
-    where => {"$table1.$key1" => 1}
2826
+  column => [
2827
+    $model->mycolumn,
2828
+    {$table2 => [$key1, $key3]}
2829
+  ],
2830
+  where => {"$table1.$key1" => 1}
2833 2831
 );
2834 2832
 is_deeply($result->one,
2835
-          {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
2833
+        {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
2836 2834
 is_deeply($model2->select->one, {$key1 => 1, $key3 => 3});
2837 2835
 
2838 2836
 $dbi->separator('__');
2839 2837
 $model = $dbi->model($table1);
2840 2838
 $result = $model->select(
2841
-    column => [
2842
-        $model->mycolumn,
2843
-        {$table2 => [$key1, $key3]}
2844
-    ],
2845
-    where => {"$table1.$key1" => 1}
2839
+  column => [
2840
+    $model->mycolumn,
2841
+    {$table2 => [$key1, $key3]}
2842
+  ],
2843
+  where => {"$table1.$key1" => 1}
2846 2844
 );
2847 2845
 is_deeply($result->one,
2848
-          {$key1 => 1, $key2 => 2, "${table2}__$key1" => 1, "${table2}__$key3" => 3});
2846
+        {$key1 => 1, $key2 => 2, "${table2}__$key1" => 1, "${table2}__$key3" => 3});
2849 2847
 is_deeply($model2->select->one, {$key1 => 1, $key3 => 3});
2850 2848
 
2851 2849
 $dbi->separator('-');
2852 2850
 $model = $dbi->model($table1);
2853 2851
 $result = $model->select(
2854
-    column => [
2855
-        $model->mycolumn,
2856
-        {$table2 => [$key1, $key3]}
2857
-    ],
2858
-    where => {"$table1.$key1" => 1}
2852
+  column => [
2853
+    $model->mycolumn,
2854
+    {$table2 => [$key1, $key3]}
2855
+  ],
2856
+  where => {"$table1.$key1" => 1}
2859 2857
 );
2860 2858
 is_deeply($result->one,
2861
-          {$key1 => 1, $key2 => 2, "$table2-$key1" => 1, "$table2-$key3" => 3});
2859
+  {$key1 => 1, $key2 => 2, "$table2-$key1" => 1, "$table2-$key3" => 3});
2862 2860
 is_deeply($model2->select->one, {$key1 => 1, $key3 => 3});
2863 2861
 
2864 2862
 
... ...
@@ -2871,11 +2869,11 @@ $dbi->execute($create_table1);
2871 2869
 $dbi->execute($create_table2);
2872 2870
 
2873 2871
 $dbi->create_model(
2874
-    table => $table1,
2875
-    join => [
2876
-       "left outer join $table2 on $table1.$key1 = $table2.$key1"
2877
-    ],
2878
-    primary_key => [$key1],
2872
+  table => $table1,
2873
+  join => [
2874
+   "left outer join $table2 on $table1.$key1 = $table2.$key1"
2875
+  ],
2876
+  primary_key => [$key1],
2879 2877
 );
2880 2878
 $dbi->setup_model;
2881 2879
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
... ...
@@ -2901,57 +2899,57 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}], "table");
2901 2899
 test 'mapper';
2902 2900
 $dbi = DBIx::Custom->connect;
2903 2901
 $param = $dbi->mapper(param => {id => 1, author => 'Ken', price => 1900})->map(
2904
-    id => {key => "$table1.id"},
2905
-    author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2906
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
2902
+  id => {key => "$table1.id"},
2903
+  author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2904
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
2907 2905
 );
2908 2906
 is_deeply($param, {"$table1.id" => 1, "$table1.author" => '%Ken%',
2909
-  "$table1.price" => 1900});
2907
+"$table1.price" => 1900});
2910 2908
 
2911 2909
 $dbi = DBIx::Custom->connect;
2912 2910
 $param = $dbi->mapper(param => {id => 1, author => 'Ken', price => 1900})->map(
2913
-    id => {key => "$table1.id"},
2914
-    author => ["$table1.author" => $dbi->like_value],
2915
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
2911
+  id => {key => "$table1.id"},
2912
+  author => ["$table1.author" => $dbi->like_value],
2913
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
2916 2914
 );
2917 2915
 is_deeply($param, {"$table1.id" => 1, "$table1.author" => '%Ken%',
2918
-  "$table1.price" => 1900});
2916
+"$table1.price" => 1900});
2919 2917
 
2920 2918
 $param = $dbi->mapper(param => {id => 0, author => 0, price => 0})->map(
2921
-    id => {key => "$table1.id"},
2922
-    author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2923
-    price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 0 }]
2919
+  id => {key => "$table1.id"},
2920
+  author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2921
+  price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 0 }]
2924 2922
 );
2925 2923
 is_deeply($param, {"$table1.id" => 0, "$table1.author" => '%0%', "$table1.price" => '%0%'});
2926 2924
 
2927 2925
 $param = $dbi->mapper(param => {id => '', author => '', price => ''})->map(
2928
-    id => {key => "$table1.id"},
2929
-    author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2930
-    price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 1 }]
2926
+  id => {key => "$table1.id"},
2927
+  author => ["$table1.author" => sub { '%' . $_[0] . '%' }],
2928
+  price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 1 }]
2931 2929
 );
2932 2930
 is_deeply($param, {});
2933 2931
 
2934 2932
 $param = $dbi->mapper(param => {id => undef, author => undef, price => undef})->map(
2935
-    id => {key => "$table1.id"},
2936
-    price => {key => "$table1.price", condition => 'exists'}
2933
+  id => {key => "$table1.id"},
2934
+  price => {key => "$table1.price", condition => 'exists'}
2937 2935
 );
2938 2936
 is_deeply($param, {"$table1.price" => undef});
2939 2937
 
2940 2938
 $param = $dbi->mapper(param => {price => 'a'})->map(
2941
-    id => {key => "$table1.id", condition => 'exists'},
2942
-    price => ["$table1.price", sub { '%' . $_[0] }, 'exists']
2939
+  id => {key => "$table1.id", condition => 'exists'},
2940
+  price => ["$table1.price", sub { '%' . $_[0] }, 'exists']
2943 2941
 );
2944 2942
 is_deeply($param, {"$table1.price" => '%a'});
2945 2943
 
2946 2944
 $param = $dbi->mapper(param => {price => 'a'}, condition => 'exists')->map(
2947
-    id => {key => "$table1.id"},
2948
-    price => ["$table1.price", sub { '%' . $_[0] }]
2945
+  id => {key => "$table1.id"},
2946
+  price => ["$table1.price", sub { '%' . $_[0] }]
2949 2947
 );
2950 2948
 is_deeply($param, {"$table1.price" => '%a'});
2951 2949
 
2952 2950
 $param = $dbi->mapper(param => {price => 'a', author => 'b'})->map(
2953
-    price => sub { '%' . $_[0] },
2954
-    author => 'book.author'
2951
+  price => sub { '%' . $_[0] },
2952
+  author => 'book.author'
2955 2953
 );
2956 2954
 is_deeply($param, {price => '%a', 'book.author' => 'b'});
2957 2955
 
... ...
@@ -2993,7 +2991,7 @@ is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
2993 2991
 $where = $dbi->where;
2994 2992
 $where->clause(['and', ":${key1}{=}"]);
2995 2993
 $param = $dbi->mapper(param => {$key1 => 0}, condition => 'length')
2996
-  ->pass([$key1, $key2])->map;
2994
+->pass([$key1, $key2])->map;
2997 2995
 $where->param($param);
2998 2996
 $result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
2999 2997
 $row = $result->all;
... ...
@@ -3010,7 +3008,7 @@ is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
3010 3008
 $where = $dbi->where;
3011 3009
 $where->clause(['and', ":${key1}{=}"]);
3012 3010
 $param = $dbi->mapper(param => {$key1 => 5}, condition => sub { ($_[0] || '') eq 5 })
3013
-  ->pass([$key1, $key2])->map;
3011
+->pass([$key1, $key2])->map;
3014 3012
 $where->param($param);
3015 3013
 $result = $dbi->execute("select * from $table1 $where", {$key1 => 1});
3016 3014
 $row = $result->all;
... ...
@@ -3027,76 +3025,76 @@ is_deeply($row, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
3027 3025
 
3028 3026
 $where = $dbi->where;
3029 3027
 $param = $dbi->mapper(param => {id => 1, author => 'Ken', price => 1900})->map(
3030
-    id => {key => "$table1.id"},
3031
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3032
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3028
+  id => {key => "$table1.id"},
3029
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3030
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3033 3031
 );
3034 3032
 $where->param($param);
3035 3033
 is_deeply($where->param, {"$table1.id" => 1, "$table1.author" => '%Ken%',
3036
-  "$table1.price" => 1900});
3034
+"$table1.price" => 1900});
3037 3035
 
3038 3036
 $where = $dbi->where;
3039 3037
 $param = $dbi->mapper(param => {id => 0, author => 0, price => 0})->map(
3040
-    id => {key => "$table1.id"},
3041
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3042
-    price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 0 }]
3038
+  id => {key => "$table1.id"},
3039
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3040
+  price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 0 }]
3043 3041
 );
3044 3042
 $where->param($param);
3045 3043
 is_deeply($where->param, {"$table1.id" => 0, "$table1.author" => '%0%', "$table1.price" => '%0%'});
3046 3044
 
3047 3045
 $where = $dbi->where;
3048 3046
 $param = $dbi->mapper(param => {id => '', author => '', price => ''})->map(
3049
-    id => {key => "$table1.id"},
3050
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3051
-    price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 1 }]
3047
+  id => {key => "$table1.id"},
3048
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3049
+  price => ["$table1.price", sub { '%' . $_[0] . '%' }, sub { $_[0] eq 1 }]
3052 3050
 );
3053 3051
 $where->param($param);
3054 3052
 is_deeply($where->param, {});
3055 3053
 
3056 3054
 $where = $dbi->where;
3057 3055
 $param = $dbi->mapper(param => {id => undef, author => undef, price => undef}, condition => 'exists')->map(
3058
-    id => {key => "$table1.id"},
3059
-    price => {key => "$table1.price", condition => 'exists'}
3056
+  id => {key => "$table1.id"},
3057
+  price => {key => "$table1.price", condition => 'exists'}
3060 3058
 );
3061 3059
 is_deeply($param, {"$table1.id"  => undef,"$table1.price" => undef});
3062 3060
 
3063 3061
 $where = $dbi->where;
3064 3062
 $param = $dbi->mapper(param => {price => 'a'})->map(
3065
-    id => {key => "$table1.id", condition => 'exists'},
3066
-    price => ["$table1.price", sub { '%' . $_[0] }, 'exists']
3063
+  id => {key => "$table1.id", condition => 'exists'},
3064
+  price => ["$table1.price", sub { '%' . $_[0] }, 'exists']
3067 3065
 );
3068 3066
 is_deeply($param, {"$table1.price" => '%a'});
3069 3067
 
3070 3068
 $where = $dbi->where;
3071 3069
 $param = $dbi->mapper(param => {id => [1, 2], author => 'Ken', price => 1900})->map(
3072
-    id => {key => "$table1.id"},
3073
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3074
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3070
+  id => {key => "$table1.id"},
3071
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3072
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3075 3073
 );
3076 3074
 is_deeply($param, {"$table1.id" => [1, 2], "$table1.author" => '%Ken%',
3077
-  "$table1.price" => 1900});
3075
+"$table1.price" => 1900});
3078 3076
 
3079 3077
 $where = $dbi->where;
3080 3078
 $param = $dbi->mapper(param => {id => ['', ''], author => 'Ken', price => 1900}, condition => 'length')->map(
3081
-    id => {key => "$table1.id"},
3082
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3083
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3079
+  id => {key => "$table1.id"},
3080
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }],
3081
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3084 3082
 );
3085 3083
 is_deeply($param, {"$table1.id" => [$dbi->not_exists, $dbi->not_exists], "$table1.author" => '%Ken%',
3086
-  "$table1.price" => 1900});
3084
+"$table1.price" => 1900});
3087 3085
 
3088 3086
 $where = $dbi->where;
3089 3087
 $param = $dbi->mapper(param => {id => ['', ''], author => 'Ken', price => 1900})->map(
3090
-    id => {key => "$table1.id", condition => 'length'},
3091
-    author => ["$table1.author", sub { '%' . $_[0] . '%' }, 'defined'],
3092
-    price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3088
+  id => {key => "$table1.id", condition => 'length'},
3089
+  author => ["$table1.author", sub { '%' . $_[0] . '%' }, 'defined'],
3090
+  price => {key => "$table1.price", condition => sub { $_[0] eq 1900 }}
3093 3091
 );
3094 3092
 is_deeply($param, {"$table1.id" => [$dbi->not_exists, $dbi->not_exists], "$table1.author" => '%Ken%',
3095
-  "$table1.price" => 1900});
3093
+"$table1.price" => 1900});
3096 3094
 
3097 3095
 $where = $dbi->where;
3098 3096
 $param = $dbi->mapper(param => {id => 'a', author => 'b', price => 'c'}, pass => [qw/id author/])
3099
-  ->map(price => {key => 'book.price'});
3097
+->map(price => {key => 'book.price'});
3100 3098
 is_deeply($param, {id => 'a', author => 'b', 'book.price' => 'c'});
3101 3099
 
3102 3100
 test 'order';
... ...
@@ -3111,21 +3109,21 @@ my $order = $dbi->order;
3111 3109
 $order->prepend($key1, "$key2 desc");
3112 3110
 $result = $dbi->select(table => $table1, append => $order);
3113 3111
 is_deeply($result->all, [{$key1 => 1, $key2 => 3}, {$key1 => 1, $key2 => 1},
3114
-  {$key1 => 2, $key2 => 4}, {$key1 => 2, $key2 => 2}]);
3112
+{$key1 => 2, $key2 => 4}, {$key1 => 2, $key2 => 2}]);
3115 3113
 $order->prepend("$key1 desc");
3116 3114
 $result = $dbi->select(table => $table1, append => $order);
3117 3115
 is_deeply($result->all, [{$key1 => 2, $key2 => 4}, {$key1 => 2, $key2 => 2},
3118
-  {$key1 => 1, $key2 => 3}, {$key1 => 1, $key2 => 1}]);
3116
+{$key1 => 1, $key2 => 3}, {$key1 => 1, $key2 => 1}]);
3119 3117
 
3120 3118
 $order = $dbi->order;
3121 3119
 $order->prepend(["$table1-$key1"], ["$table1-$key2", 'desc']);
3122 3120
 $result = $dbi->select(table => $table1,
3123
-  column => [[$key1 => "$table1-$key1"], [$key2 => "$table1-$key2"]],
3124
-  append => $order);
3121
+column => [[$key1 => "$table1-$key1"], [$key2 => "$table1-$key2"]],
3122
+append => $order);
3125 3123
 is_deeply($result->all, [{"$table1-$key1" => 1, "$table1-$key2" => 3},
3126
-  {"$table1-$key1" => 1, "$table1-$key2" => 1},
3127
-  {"$table1-$key1" => 2, "$table1-$key2" => 4},
3128
-  {"$table1-$key1" => 2, "$table1-$key2" => 2}]);
3124
+{"$table1-$key1" => 1, "$table1-$key2" => 1},
3125
+{"$table1-$key1" => 2, "$table1-$key2" => 4},
3126
+{"$table1-$key1" => 2, "$table1-$key2" => 2}]);
3129 3127
 
3130 3128
 test 'tag_parse';
3131 3129
 $dbi = DBIx::Custom->connect;
... ...
@@ -3138,26 +3136,26 @@ ok($@);
3138 3136
 
3139 3137
 test 'DBIX_CUSTOM_TAG_PARSE environment variable';
3140 3138
 {
3141
-    $ENV{DBIX_CUSTOM_TAG_PARSE} = 0;
3142
-    $dbi = DBIx::Custom->connect;
3143
-    eval { $dbi->execute("drop table $table1") };
3144
-    $dbi->execute($create_table1);
3145
-    $dbi->insert({$key1 => 1, $key2 => 1}, table => $table1);
3146
-    eval {$dbi->execute("select * from $table1 where {= $key1}", {$key1 => 1})};
3147
-    ok($@);
3148
-    eval {$dbi->select(table => $table1, where => ["{= $key1}", {$key1 => 1}]) };
3149
-    ok($@);
3150
-    delete$ENV{DBIX_CUSTOM_TAG_PARSE};
3139
+  $ENV{DBIX_CUSTOM_TAG_PARSE} = 0;
3140
+  $dbi = DBIx::Custom->connect;
3141
+  eval { $dbi->execute("drop table $table1") };
3142
+  $dbi->execute($create_table1);
3143
+  $dbi->insert({$key1 => 1, $key2 => 1}, table => $table1);
3144
+  eval {$dbi->execute("select * from $table1 where {= $key1}", {$key1 => 1})};
3145
+  ok($@);
3146
+  eval {$dbi->select(table => $table1, where => ["{= $key1}", {$key1 => 1}]) };
3147
+  ok($@);
3148
+  delete$ENV{DBIX_CUSTOM_TAG_PARSE};
3151 3149
 }
3152 3150
 
3153 3151
 {
3154
-    $ENV{DBIX_CUSTOM_TAG_PARSE} = 0;
3155
-    $dbi = DBIx::Custom->connect;
3156
-    eval { $dbi->execute("drop table $table1") };
3157
-    $dbi->execute($create_table1);
3158
-    $dbi->insert({$key1 => 1, $key2 => 1}, table => $table1);
3159
-    is($dbi->select(table => $table1, wher => {$key1 => 1})->one->{$key1}, 1);
3160
-    delete$ENV{DBIX_CUSTOM_TAG_PARSE};
3152
+  $ENV{DBIX_CUSTOM_TAG_PARSE} = 0;
3153
+  $dbi = DBIx::Custom->connect;
3154
+  eval { $dbi->execute("drop table $table1") };
3155
+  $dbi->execute($create_table1);
3156
+  $dbi->insert({$key1 => 1, $key2 => 1}, table => $table1);
3157
+  is($dbi->select(table => $table1, wher => {$key1 => 1})->one->{$key1}, 1);
3158
+  delete$ENV{DBIX_CUSTOM_TAG_PARSE};
3161 3159
 }
3162 3160
 
3163 3161
 test 'last_sql';
... ...
@@ -3200,9 +3198,9 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}])
3200 3198
 
3201 3199
 $source = "select * from $table1 where :$table1.${key1}{=} and :$table1.${key2}{=}";
3202 3200
 $result = $dbi->execute(
3203
-    $source,
3204
-    {"$table1.$key1" => 1, "$table1.$key2" => 1},
3205
-    filter => {"$table1.$key2" => sub { $_[0] * 2 }}
3201
+  $source,
3202
+  {"$table1.$key1" => 1, "$table1.$key2" => 1},
3203
+  filter => {"$table1.$key2" => sub { $_[0] * 2 }}
3206 3204
 );
3207 3205
 $rows = $result->all;
3208 3206
 is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}]);
... ...
@@ -3211,107 +3209,107 @@ test 'high perfomance way';
3211 3209
 eval { $dbi->execute("drop table $table1") };
3212 3210
 $dbi->execute($create_table1_highperformance);
3213 3211
 $rows = [
3214
-    {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3215
-    {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3212
+  {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3213
+  {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3216 3214
 ];
3217 3215
 {
3218
-    my $query;
3219
-    for my $row (@$rows) {
3220
-      $query ||= $dbi->insert($row, table => $table1, query => 1);
3221
-      $dbi->execute($query, $row, filter => {$key7 => sub { $_[0] * 2 }});
3222
-    }
3223
-    is_deeply($dbi->select(table => $table1)->all,
3224
-      [
3225
-          {$key7 => 2, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3226
-          {$key7 => 2, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3227
-      ]
3228
-    );
3216
+  my $query;
3217
+  for my $row (@$rows) {
3218
+    $query ||= $dbi->insert($row, table => $table1, query => 1);
3219
+    $dbi->execute($query, $row, filter => {$key7 => sub { $_[0] * 2 }});
3220
+  }
3221
+  is_deeply($dbi->select(table => $table1)->all,
3222
+    [
3223
+      {$key7 => 2, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3224
+      {$key7 => 2, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3225
+    ]
3226
+  );
3229 3227
 }
3230 3228
 
3231 3229
 eval { $dbi->execute("drop table $table1") };
3232 3230
 $dbi->execute($create_table1_highperformance);
3233 3231
 $rows = [
3234
-    {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3235
-    {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3232
+  {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3233
+  {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3236 3234
 ];
3237 3235
 {
3238
-    my $query;
3239
-    my $sth;
3240
-    for my $row (@$rows) {
3241
-      $query ||= $dbi->insert($row, table => $table1, query => 1);
3242
-      $sth ||= $query->{sth};
3243
-      $sth->execute(map { $row->{$_} } sort keys %$row);
3244
-    }
3245
-    is_deeply($dbi->select(table => $table1)->all,
3246
-      [
3247
-          {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3248
-          {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3249
-      ]
3250
-    );
3236
+  my $query;
3237
+  my $sth;
3238
+  for my $row (@$rows) {
3239
+    $query ||= $dbi->insert($row, table => $table1, query => 1);
3240
+    $sth ||= $query->{sth};
3241
+    $sth->execute(map { $row->{$_} } sort keys %$row);
3242
+  }
3243
+  is_deeply($dbi->select(table => $table1)->all,
3244
+    [
3245
+      {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 7},
3246
+      {$key7 => 1, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => 8},
3247
+    ]
3248
+  );
3251 3249
 }
3252 3250
 
3253 3251
 eval { $dbi->execute("drop table $table1") };
3254 3252
 $dbi->execute($create_table1_highperformance);
3255 3253
 $rows = [
3256
-    {$key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5},
3257
-    {$key7 => 11, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6},
3254
+  {$key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5},
3255
+  {$key7 => 11, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6},
3258 3256
 ];
3259 3257
 {
3260
-    $model = $dbi->create_model(table => $table1, primary_key => $key1);
3261
-    my $query;
3262
-    for my $row (@$rows) {
3263
-      $query ||= $model->insert($row, query => 1);
3264
-      $model->execute($query, $row, filter => {$key7 => sub { $_[0] * 2 }});
3265
-    }
3266
-    is_deeply($dbi->select(table => $table1, append => 'order by key2')->all,
3267
-      [
3268
-          {$key7 => 20, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => undef},
3269
-          {$key7 => 22, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => undef},
3270
-      ]
3271
-    );
3258
+  $model = $dbi->create_model(table => $table1, primary_key => $key1);
3259
+  my $query;
3260
+  for my $row (@$rows) {
3261
+    $query ||= $model->insert($row, query => 1);
3262
+    $model->execute($query, $row, filter => {$key7 => sub { $_[0] * 2 }});
3263
+  }
3264
+  is_deeply($dbi->select(table => $table1, append => 'order by key2')->all,
3265
+    [
3266
+      {$key7 => 20, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => undef},
3267
+      {$key7 => 22, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 6, $key1 => undef},
3268
+    ]
3269
+  );
3272 3270
 }
3273 3271
 
3274 3272
 eval { $dbi->execute("drop table $table1") };
3275 3273
 $dbi->execute($create_table1);
3276 3274
 {
3277
-    $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE} = 1;
3278
-    $model = $dbi->create_model(table => $table1, primary_key => $key1);
3279
-    eval {$model->execute("select * from $table1 where :${key1}{=}", id => 1)};
3280
-    like($@, qr/primary_key/);
3281
-    delete $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE};
3275
+  $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE} = 1;
3276
+  $model = $dbi->create_model(table => $table1, primary_key => $key1);
3277
+  eval {$model->execute("select * from $table1 where :${key1}{=}", id => 1)};
3278
+  like($@, qr/primary_key/);
3279
+  delete $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE};
3282 3280
 }
3283 3281
 
3284 3282
 {
3285
-    $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE} = 1;
3286
-    $model = $dbi->create_model(table => $table1, primary_key => $key1);
3287
-    $model->insert({$key1 => 1});
3288
-    $result = $model->execute("select * from $table1 where :${key1}{=}", id => 1,
3289
-      table => $table1, primary_key => $key1);
3290
-    is($result->one->{$key1}, 1);
3291
-    delete $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE};
3283
+  $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE} = 1;
3284
+  $model = $dbi->create_model(table => $table1, primary_key => $key1);
3285
+  $model->insert({$key1 => 1});
3286
+  $result = $model->execute("select * from $table1 where :${key1}{=}", id => 1,
3287
+    table => $table1, primary_key => $key1);
3288
+  is($result->one->{$key1}, 1);
3289
+  delete $ENV{DBIX_CUSTOM_DISABLE_MODEL_EXECUTE};
3292 3290
 }
3293 3291
 
3294 3292
 eval { $dbi->execute("drop table $table1") };
3295 3293
 $dbi->execute($create_table1);
3296 3294
 {
3297
-    $model = $dbi->create_model(table => $table1, primary_key => $key1);
3298
-    $model->insert({$key1 => 1});
3299
-    eval {$result = $model->execute("select * from $table1 where :${key1}{=}", {}, id => 1)};
3300
-    is($result->one->{$key1}, 1);
3295
+  $model = $dbi->create_model(table => $table1, primary_key => $key1);
3296
+  $model->insert({$key1 => 1});
3297
+  eval {$result = $model->execute("select * from $table1 where :${key1}{=}", {}, id => 1)};
3298
+  is($result->one->{$key1}, 1);
3301 3299
 }
3302 3300
 
3303 3301
 test 'id option more';
3304 3302
 eval { $dbi->execute("drop table $table1") };
3305 3303
 $dbi->execute($create_table1_highperformance);
3306 3304
 $row = {
3307
-    $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3305
+  $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3308 3306
 };
3309 3307
 $model = $dbi->create_model(table => $table1, primary_key => $key1);
3310 3308
 $model->insert($row);
3311 3309
 $query = $model->update({$key7 => 11}, id => 1, query => 1);
3312 3310
 $model->execute($query, {$key7 => 11}, id => 1, filter => {"$table1.$key1" => sub { $_[0] * 2 }});
3313 3311
 is_deeply($dbi->select(table => $table1)->one,
3314
-    {$key7 => 11, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2},
3312
+  {$key7 => 11, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2},
3315 3313
 );
3316 3314
 
3317 3315
 eval { $dbi->execute("drop table $table1") };
... ...
@@ -3321,18 +3319,18 @@ $dbi->execute($create_table2);
3321 3319
 $model = $dbi->create_model(table => $table1, primary_key => $key1);
3322 3320
 $model->insert({$key1 => 1, $key2 => 2});
3323 3321
 $model = $dbi->create_model(table => $table2, primary_key => $key1,
3324
-    join => ["left outer join $table1 on $table2.$key1 = $table1.$key1"]);
3322
+  join => ["left outer join $table1 on $table2.$key1 = $table1.$key1"]);
3325 3323
 $model->insert({$key1 => 1, $key3 => 3});
3326 3324
 $result = $model->select(
3327
-    column => {$table1 => ["$key2"]},
3328
-    id => 1
3325
+  column => {$table1 => ["$key2"]},
3326
+  id => 1
3329 3327
 );
3330 3328
 is_deeply($result->all, [{"$table1.$key2" => 2}]);
3331 3329
 
3332 3330
 eval { $dbi->execute("drop table $table1") };
3333 3331
 $dbi->execute($create_table1_highperformance);
3334 3332
 $row = {
3335
-    $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3333
+  $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3336 3334
 };
3337 3335
 $model = $dbi->create_model(table => $table1, primary_key => $key1);
3338 3336
 $model->insert($row);
... ...
@@ -3343,7 +3341,7 @@ is_deeply($dbi->select(table => $table1)->all, []);
3343 3341
 eval { $dbi->execute("drop table $table1") };
3344 3342
 eval { $dbi->execute($create_table1_highperformance) };
3345 3343
 $row = {
3346
-    $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3344
+  $key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2
3347 3345
 };
3348 3346
 $model = $dbi->create_model(table => $table1, primary_key => $key1);
3349 3347
 $model->insert($row);
... ...
@@ -3351,7 +3349,7 @@ $query = $model->select(id => 1, query => 1);
3351 3349
 $model->execute($query, {$key7 => 11}, id => 1, filter => {"$table1.$key1" => sub { $_[0] * 2 }});
3352 3350
 $query = undef;
3353 3351
 is_deeply($dbi->select(table => $table1)->one,
3354
-    {$key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2},
3352
+  {$key7 => 10, $key6 => 2, $key5 => 3, $key4 => 4, $key3 => 5, $key2 => 5, $key1 => 2},
3355 3353
 );
3356 3354
 
3357 3355
 test 'result';
... ...
@@ -3364,14 +3362,14 @@ $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
3364 3362
 $result = $dbi->select(table => $table1);
3365 3363
 @rows = ();
3366 3364
 while (my $row = $result->fetch) {
3367
-    push @rows, [@$row];
3365
+  push @rows, [@$row];
3368 3366
 }
3369 3367
 is_deeply(\@rows, [[1, 2], [3, 4]]);
3370 3368
 
3371 3369
 $result = $dbi->select(table => $table1);
3372 3370
 @rows = ();
3373 3371
 while (my $row = $result->fetch_hash) {
3374
-    push @rows, {%$row};
3372
+  push @rows, {%$row};
3375 3373
 }
3376 3374
 is_deeply(\@rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}]);
3377 3375
 
... ...
@@ -3438,59 +3436,59 @@ ok(!$rows);
3438 3436
 
3439 3437
 test "query_builder";
3440 3438
 $datas = [
3441
-    # Basic tests
3442
-    {   name            => 'placeholder basic',
3443
-        source            => "a {?  k1} b {=  k2} {<> k3} {>  k4} {<  k5} {>= k6} {<= k7} {like k8}", ,
3444
-        sql_expected    => "a ? b k2 = ? k3 <> ? k4 > ? k5 < ? k6 >= ? k7 <= ? k8 like ?",
3445
-        columns_expected   => [qw/k1 k2 k3 k4 k5 k6 k7 k8/]
3446
-    },
3447
-    {
3448
-        name            => 'placeholder in',
3449
-        source            => "{in k1 3}",
3450
-        sql_expected    => "k1 in (?, ?, ?)",
3451
-        columns_expected   => [qw/k1 k1 k1/]
3452
-    },
3453
-    
3454
-    # Table name
3455
-    {
3456
-        name            => 'placeholder with table name',
3457
-        source            => "{= a.k1} {= a.k2}",
3458
-        sql_expected    => "a.k1 = ? a.k2 = ?",
3459
-        columns_expected  => [qw/a.k1 a.k2/]
3460
-    },
3461
-    {   
3462
-        name            => 'placeholder in with table name',
3463
-        source            => "{in a.k1 2} {in b.k2 2}",
3464
-        sql_expected    => "a.k1 in (?, ?) b.k2 in (?, ?)",
3465
-        columns_expected  => [qw/a.k1 a.k1 b.k2 b.k2/]
3466
-    },
3467
-    {
3468
-        name            => 'not contain tag',
3469
-        source            => "aaa",
3470
-        sql_expected    => "aaa",
3471
-        columns_expected  => [],
3472
-    }
3439
+  # Basic tests
3440
+  {   name            => 'placeholder basic',
3441
+    source            => "a {?  k1} b {=  k2} {<> k3} {>  k4} {<  k5} {>= k6} {<= k7} {like k8}", ,
3442
+    sql_expected    => "a ? b k2 = ? k3 <> ? k4 > ? k5 < ? k6 >= ? k7 <= ? k8 like ?",
3443
+    columns_expected   => [qw/k1 k2 k3 k4 k5 k6 k7 k8/]
3444
+  },
3445
+  {
3446
+    name            => 'placeholder in',
3447
+    source            => "{in k1 3}",
3448
+    sql_expected    => "k1 in (?, ?, ?)",
3449
+    columns_expected   => [qw/k1 k1 k1/]
3450
+  },
3451
+  
3452
+  # Table name
3453
+  {
3454
+    name            => 'placeholder with table name',
3455
+    source            => "{= a.k1} {= a.k2}",
3456
+    sql_expected    => "a.k1 = ? a.k2 = ?",
3457
+    columns_expected  => [qw/a.k1 a.k2/]
3458
+  },
3459
+  {   
3460
+    name            => 'placeholder in with table name',
3461
+    source            => "{in a.k1 2} {in b.k2 2}",
3462
+    sql_expected    => "a.k1 in (?, ?) b.k2 in (?, ?)",
3463
+    columns_expected  => [qw/a.k1 a.k1 b.k2 b.k2/]
3464
+  },
3465
+  {
3466
+    name            => 'not contain tag',
3467
+    source            => "aaa",
3468
+    sql_expected    => "aaa",
3469
+    columns_expected  => [],
3470
+  }
3473 3471
 ];
3474 3472
 
3475 3473
 for (my $i = 0; $i < @$datas; $i++) {
3476
-    my $data = $datas->[$i];
3477
-    my $dbi = DBIx::Custom->new;
3478
-    my $builder = $dbi->query_builder;
3479
-    my $query = $builder->build_query($data->{source});
3480
-    is($query->{sql}, $data->{sql_expected}, "$data->{name} : sql");
3481
-    is_deeply($query->{columns}, $data->{columns_expected}, "$data->{name} : columns");
3474
+  my $data = $datas->[$i];
3475
+  my $dbi = DBIx::Custom->new;
3476
+  my $builder = $dbi->query_builder;
3477
+  my $query = $builder->build_query($data->{source});
3478
+  is($query->{sql}, $data->{sql_expected}, "$data->{name} : sql");
3479
+  is_deeply($query->{columns}, $data->{columns_expected}, "$data->{name} : columns");
3482 3480
 }
3483 3481
 
3484 3482
 $dbi = DBIx::Custom->new;
3485 3483
 $builder = $dbi->query_builder;
3486 3484
 $dbi->register_tag(
3487
-    p => sub {
3488
-        my @args = @_;
3489
-        
3490
-        my $expand    = "? $args[0] $args[1]";
3491
-        my $columns = [2];
3492
-        return [$expand, $columns];
3493
-    }
3485
+  p => sub {
3486
+    my @args = @_;
3487
+    
3488
+    my $expand    = "? $args[0] $args[1]";
3489
+    my $columns = [2];
3490
+    return [$expand, $columns];
3491
+  }
3494 3492
 );
3495 3493
 
3496 3494
 $query = $builder->build_query("{p a b}");
... ...
@@ -3504,28 +3502,28 @@ eval{$builder->build_query("{a }")};
3504 3502
 like($@, qr/\QTag "a" is not registered/, "tag not exist");
3505 3503
 
3506 3504
 $dbi->register_tag({
3507
-    q => 'string'
3505
+  q => 'string'
3508 3506
 });
3509 3507
 
3510 3508
 eval{$builder->build_query("{q}", {})};
3511 3509
 like($@, qr/Tag "q" must be sub reference/, "tag not code ref");
3512 3510
 
3513 3511
 $dbi->register_tag({
3514
-   r => sub {} 
3512
+  r => sub {} 
3515 3513
 });
3516 3514
 
3517 3515
 eval{$builder->build_query("{r}")};
3518 3516
 like($@, qr/\QTag "r" must return [STRING, ARRAY_REFERENCE]/, "tag return noting");
3519 3517
 
3520 3518
 $dbi->register_tag({
3521
-   s => sub { return ["a", ""]} 
3519
+  s => sub { return ["a", ""]} 
3522 3520
 });
3523 3521
 
3524 3522
 eval{$builder->build_query("{s}")};
3525 3523
 like($@, qr/\QTag "s" must return [STRING, ARRAY_REFERENCE]/, "tag return not array columns");
3526 3524
 
3527 3525
 $dbi->register_tag(
3528
-    t => sub {return ["a", []]}
3526
+  t => sub {return ["a", []]}
3529 3527
 );
3530 3528
 
3531 3529
 
... ...
@@ -3538,11 +3536,11 @@ like($@, qr/Column name and count of values must be specified in tag "{in }"/, "
3538 3536
 
3539 3537
 eval{$builder->build_query("{in a}")};
3540 3538
 like($@, qr/\QColumn name and count of values must be specified in tag "{in }"/,
3541
-     "in : key not exist");
3539
+  "in : key not exist");
3542 3540
 
3543 3541
 eval{$builder->build_query("{in a r}")};
3544 3542
 like($@, qr/\QColumn name and count of values must be specified in tag "{in }"/,
3545
-     "in : key not exist");
3543
+  "in : key not exist");
3546 3544
 
3547 3545
 test 'variouse source';
3548 3546
 $source = "a {= b} c \\{ \\} {= \\{} {= \\}} d";
... ...
@@ -3577,13 +3575,13 @@ $dbi->execute($create_table1);
3577 3575
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
3578 3576
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
3579 3577
 $rows = $dbi->select(
3580
-    table => $table1,
3581
-    column => $key1,
3582
-    sqlfilter => sub {
3583
-        my $sql = shift;
3584
-        $sql = "select * from ( $sql ) t where $key1 = 1";
3585
-        return $sql;
3586
-    }
3578
+  table => $table1,
3579
+  column => $key1,
3580
+  sqlfilter => sub {
3581
+    my $sql = shift;
3582
+    $sql = "select * from ( $sql ) t where $key1 = 1";
3583
+    return $sql;
3584
+  }
3587 3585
 )->all;
3588 3586
 is_deeply($rows, [{$key1 => 1}]);
3589 3587
 
... ...
@@ -3595,13 +3593,13 @@ $dbi->execute($create_table1);
3595 3593
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
3596 3594
 $dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
3597 3595
 $rows = $dbi->select(
3598
-    table => $table1,
3599
-    column => $key1,
3600
-    after_build_sql => sub {
3601
-        my $sql = shift;
3602
-        $sql = "select * from ( $sql ) t where $key1 = 1";
3603
-        return $sql;
3604
-    }
3596
+  table => $table1,
3597
+  column => $key1,
3598
+  after_build_sql => sub {
3599
+    my $sql = shift;
3600
+    $sql = "select * from ( $sql ) t where $key1 = 1";
3601
+    return $sql;
3602
+  }
3605 3603
 )->all;
3606 3604
 is_deeply($rows, [{$key1 => 1}]);
3607 3605
 
... ...
@@ -3626,33 +3624,33 @@ $dbi->execute("insert into $table1 ($key1, $key2) values (1, 2)");
3626 3624
 $dbi->execute("insert into $table2 ($key1, $key3) values (1, 4)");
3627 3625
 $model = $dbi->model($table1);
3628 3626
 $result = $model->select(
3629
-    column => [
3630
-        $model->column($table2, {alias => $table2_alias})
3631
-    ],
3632
-    where => {"$table2_alias.$key3" => 4}
3627
+  column => [
3628
+    $model->column($table2, {alias => $table2_alias})
3629
+  ],
3630
+  where => {"$table2_alias.$key3" => 4}
3633 3631
 );
3634 3632
 is_deeply($result->one, 
3635
-          {"$table2_alias.$key1" => 1, "$table2_alias.$key3" => 4});
3633
+        {"$table2_alias.$key1" => 1, "$table2_alias.$key3" => 4});
3636 3634
 
3637 3635
 $dbi->separator('__');
3638 3636
 $result = $model->select(
3639
-    column => [
3640
-        $model->column($table2, {alias => $table2_alias})
3641
-    ],
3642
-    where => {"$table2_alias.$key3" => 4}
3637
+  column => [
3638
+    $model->column($table2, {alias => $table2_alias})
3639
+  ],
3640
+  where => {"$table2_alias.$key3" => 4}
3643 3641
 );
3644 3642
 is_deeply($result->one, 
3645
-          {"${table2_alias}__$key1" => 1, "${table2_alias}__$key3" => 4});
3643
+  {"${table2_alias}__$key1" => 1, "${table2_alias}__$key3" => 4});
3646 3644
 
3647 3645
 $dbi->separator('-');
3648 3646
 $result = $model->select(
3649
-    column => [
3650
-        $model->column($table2, {alias => $table2_alias})
3651
-    ],
3652
-    where => {"$table2_alias.$key3" => 4}
3647
+  column => [
3648
+      $model->column($table2, {alias => $table2_alias})
3649
+  ],
3650
+  where => {"$table2_alias.$key3" => 4}
3653 3651
 );
3654 3652
 is_deeply($result->one, 
3655
-          {"$table2_alias-$key1" => 1, "$table2_alias-$key3" => 4});
3653
+  {"$table2_alias-$key1" => 1, "$table2_alias-$key3" => 4});
3656 3654
 
3657 3655
 test 'create_model';
3658 3656
 $dbi = DBIx::Custom->connect;
... ...
@@ -3663,31 +3661,31 @@ $dbi->execute($create_table1);
3663 3661
 $dbi->execute($create_table2);
3664 3662
 
3665 3663
 $dbi->create_model(
3666
-    table => $table1,
3667
-    join => [
3668
-       "left outer join $table2 on $table1.$key1 = $table2.$key1"
3669
-    ],
3670
-    primary_key => [$key1]
3664
+  table => $table1,
3665
+  join => [
3666
+   "left outer join $table2 on $table1.$key1 = $table2.$key1"
3667
+  ],
3668
+  primary_key => [$key1]
3671 3669
 );
3672 3670
 $model2 = $dbi->create_model(
3673
-    table => $table2
3671
+  table => $table2
3674 3672
 );
3675 3673
 $dbi->create_model(
3676
-    table => $table3,
3677
-    filter => [
3678
-        $key1 => {in => sub { uc $_[0] }}
3679
-    ]
3674
+  table => $table3,
3675
+  filter => [
3676
+    $key1 => {in => sub { uc $_[0] }}
3677
+  ]
3680 3678
 );
3681 3679
 $dbi->setup_model;
3682 3680
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
3683 3681
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
3684 3682
 $model = $dbi->model($table1);
3685 3683
 $result = $model->select(
3686
-    column => [$model->mycolumn, $model->column($table2)],
3687
-    where => {"$table1.$key1" => 1}
3684
+  column => [$model->mycolumn, $model->column($table2)],
3685
+  where => {"$table1.$key1" => 1}
3688 3686
 );
3689 3687
 is_deeply($result->one,
3690
-          {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
3688
+  {$key1 => 1, $key2 => 2, "$table2.$key1" => 1, "$table2.$key3" => 3});
3691 3689
 is_deeply($model2->select->one, {$key1 => 1, $key3 => 3});
3692 3690
 
3693 3691
 test 'model method';
... ...
@@ -3696,7 +3694,7 @@ eval { $dbi->execute("drop table $table2") };
3696 3694
 $dbi->execute($create_table2);
3697 3695
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
3698 3696
 $model = $dbi->create_model(
3699
-    table => $table2
3697
+  table => $table2
3700 3698
 );
3701 3699
 $model->method(foo => sub { shift->select(@_) });
3702 3700
 is_deeply($model->foo->one, {$key1 => 1, $key3 => 3});
... ...
@@ -3707,7 +3705,7 @@ eval { $dbi->execute("drop table $table2") };
3707 3705
 $dbi->execute($create_table2);
3708 3706
 $dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
3709 3707
 $model = $dbi->create_model(
3710
-    table => $table2
3708
+  table => $table2
3711 3709
 );
3712 3710
 $model->helper(foo => sub { shift->select(@_) });
3713 3711
 is_deeply($model->foo->one, {$key1 => 1, $key3 => 3});
... ...
@@ -3729,8 +3727,8 @@ $dbi->execute($sql, $param);
3729 3727
 $result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
3730 3728
 $rows   = $result->all;
3731 3729
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
3732
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3733
-                  "basic");
3730
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3731
+  "basic");
3734 3732
 
3735 3733
 
3736 3734
 $dbi = DBIx::Custom->connect;
... ...
@@ -3749,8 +3747,8 @@ $dbi->execute($sql, $param);
3749 3747
 $result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
3750 3748
 $rows   = $result->all;
3751 3749
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 33, $key4 => 4, $key5 => 5},
3752
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3753
-                  "basic");
3750
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3751
+  "basic");
3754 3752
 
3755 3753
 $dbi = DBIx::Custom->connect;
3756 3754
 eval { $dbi->execute("drop table $table1") };
... ...
@@ -3768,10 +3766,10 @@ $dbi->execute($sql, $param);
3768 3766
 $result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
3769 3767
 $rows   = $result->all;
3770 3768
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 33, $key4 => 4, $key5 => 5},
3771
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3772
-                  "update param no_set");
3769
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3770
+  "update param no_set");
3773 3771
 
3774
-            
3772
+          
3775 3773
 $dbi = DBIx::Custom->connect;
3776 3774
 eval { $dbi->execute("drop table $table1") };
3777 3775
 $dbi->execute($create_table1_2);
... ...
@@ -3788,8 +3786,8 @@ $dbi->execute($sql, $param, table => $table1);
3788 3786
 $result = $dbi->execute("select * from $table1 order by $key1");
3789 3787
 $rows   = $result->all;
3790 3788
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
3791
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3792
-                  "basic");
3789
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3790
+  "basic");
3793 3791
 
3794 3792
 $param = {$key2 => 11};
3795 3793
 $assign_clause = $dbi->assign_clause($param);
... ...
@@ -3801,8 +3799,8 @@ $dbi->execute($sql, $param, table => $table1);
3801 3799
 $result = $dbi->execute("select * from $table1 order by $key1");
3802 3800
 $rows   = $result->all;
3803 3801
 is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
3804
-                  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3805
-                  "basic");
3802
+  {$key1 => 6, $key2 => 7,  $key3 => 8, $key4 => 9, $key5 => 10}],
3803
+  "basic");
3806 3804
 
3807 3805
 test 'Model class';
3808 3806
 $dbi = MyDBI1->connect;
... ...
@@ -3878,22 +3876,22 @@ $dbi->execute($create_table2);
3878 3876
 
3879 3877
 $infos = [];
3880 3878
 $dbi->each_column(sub {
3881
-    my ($self, $table, $column, $cinfo) = @_;
3882
-    
3883
-    if ($table =~ /^table\d/i) {
3884
-         my $info = [$table, $column, $cinfo->{COLUMN_NAME}];
3885
-         push @$infos, $info;
3886
-    }
3879
+  my ($self, $table, $column, $cinfo) = @_;
3880
+  
3881
+  if ($table =~ /^table\d/i) {
3882
+     my $info = [$table, $column, $cinfo->{COLUMN_NAME}];
3883
+     push @$infos, $info;
3884
+  }
3887 3885
 });
3888 3886
 $infos = [sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } @$infos];
3889 3887
 is_deeply($infos, 
3890
-    [
3891
-        [$table1, $key1, $key1],
3892
-        [$table1, $key2, $key2],
3893
-        [$table2, $key1, $key1],
3894
-        [$table2, $key3, $key3]
3895
-    ]
3896
-    
3888
+  [
3889
+    [$table1, $key1, $key1],
3890
+    [$table1, $key2, $key2],
3891
+    [$table2, $key1, $key1],
3892
+    [$table2, $key3, $key3]
3893
+  ]
3894
+  
3897 3895
 );
3898 3896
 
3899 3897
 test 'each_table';
... ...
@@ -3905,19 +3903,19 @@ $dbi->execute($create_table1_type);
3905 3903
 
3906 3904
 $infos = [];
3907 3905
 $dbi->each_table(sub {
3908
-    my ($self, $table, $table_info) = @_;
3909
-    
3910
-    if ($table =~ /^table\d/i) {
3911
-         my $info = [$table, $table_info->{TABLE_NAME}];
3912
-         push @$infos, $info;
3913
-    }
3906
+  my ($self, $table, $table_info) = @_;
3907
+  
3908
+  if ($table =~ /^table\d/i) {
3909
+    my $info = [$table, $table_info->{TABLE_NAME}];
3910
+    push @$infos, $info;
3911
+  }
3914 3912
 });
3915 3913
 $infos = [sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } @$infos];
3916 3914
 is_deeply($infos, 
3917
-    [
3918
-        [$table1, $table1],
3919
-        [$table2, $table2],
3920
-    ]
3915
+  [
3916
+    [$table1, $table1],
3917
+    [$table2, $table2],
3918
+  ]
3921 3919
 );
3922 3920
 
3923 3921
 $dbi = DBIx::Custom->connect;
... ...
@@ -3929,20 +3927,20 @@ $dbi->execute($create_table1_type);
3929 3927
 $infos = [];
3930 3928
 $dbi->user_table_info($user_table_info);
3931 3929
 $dbi->each_table(sub {
3932
-    my ($self, $table, $table_info) = @_;
3933
-    
3934
-    if ($table =~ /^table\d/i) {
3935
-         my $info = [$table, $table_info->{TABLE_NAME}];
3936
-         push @$infos, $info;
3937
-    }
3930
+  my ($self, $table, $table_info) = @_;
3931
+  
3932
+  if ($table =~ /^table\d/i) {
3933
+     my $info = [$table, $table_info->{TABLE_NAME}];
3934
+     push @$infos, $info;
3935
+  }
3938 3936
 });
3939 3937
 $infos = [sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } @$infos];
3940 3938
 is_deeply($infos, 
3941
-    [
3942
-        [$table1, $table1],
3943
-        [$table2, $table2],
3944
-        [$table3, $table3],
3945
-    ]
3939
+  [
3940
+    [$table1, $table1],
3941
+    [$table2, $table2],
3942
+    [$table3, $table3],
3943
+  ]
3946 3944
 );
3947 3945
 
3948 3946
 test 'type_rule into';
... ...
@@ -3957,9 +3955,9 @@ $dbi->execute($create_table1_type);
3957 3955
 
3958 3956
 $dbi->user_column_info($user_column_info);
3959 3957
 $dbi->type_rule(
3960
-    into1 => {
3961
-        $date_typename => sub { '2010-' . $_[0] }
3962
-    }
3958
+  into1 => {
3959
+    $date_typename => sub { '2010-' . $_[0] }
3960
+  }
3963 3961
 );
3964 3962
 $dbi->insert({$key1 => '01-01'}, table => $table1);
3965 3963
 $result = $dbi->select(table => $table1);
... ...
@@ -3970,13 +3968,13 @@ eval { $dbi->execute("drop table $table1") };
3970 3968
 $dbi->execute($create_table1_type);
3971 3969
 $dbi->user_column_info($user_column_info);
3972 3970
 $dbi->type_rule(
3973
-    into1 => [
3974
-         [$date_typename, $datetime_typename] => sub {
3975
-            my $value = shift;
3976
-            $value =~ s/02/03/g;
3977
-            return $value;
3978
-         }
3979
-    ]
3971
+  into1 => [
3972
+     [$date_typename, $datetime_typename] => sub {
3973
+        my $value = shift;
3974
+        $value =~ s/02/03/g;
3975
+        return $value;
3976
+     }
3977
+  ]
3980 3978
 );
3981 3979
 $dbi->insert({$key1 => '2010-01-02', $key2 => '2010-01-01 01:01:02'}, table => $table1);
3982 3980
 $result = $dbi->select(table => $table1);
... ...
@@ -3990,17 +3988,17 @@ $dbi->execute($create_table1_type);
3990 3988
 $dbi->insert({$key1 => '2010-01-03', $key2 => '2010-01-01 01:01:03'}, table => $table1);
3991 3989
 $dbi->user_column_info($user_column_info);
3992 3990
 $dbi->type_rule(
3993
-    into1 => [
3994
-        [$date_typename, $datetime_typename] => sub {
3995
-            my $value = shift;
3996
-            $value =~ s/02/03/g;
3997
-            return $value;
3998
-        }
3999
-    ]
3991
+  into1 => [
3992
+    [$date_typename, $datetime_typename] => sub {
3993
+      my $value = shift;
3994
+      $value =~ s/02/03/g;
3995
+      return $value;
3996
+    }
3997
+  ]
4000 3998
 );
4001 3999
 $result = $dbi->execute(
4002
-    "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2",
4003
-    {$key1 => '2010-01-03', "$table1.$key2" => '2010-01-01 01:01:02'}
4000
+  "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2",
4001
+  {$key1 => '2010-01-03', "$table1.$key2" => '2010-01-01 01:01:02'}
4004 4002
 );
4005 4003
 $row = $result->one;
4006 4004
 like($row->{$key1}, qr/^2010-01-03/);
... ...
@@ -4012,18 +4010,18 @@ $dbi->execute($create_table1_type);
4012 4010
 $dbi->insert({$key1 => '2010-01-03', $key2 => '2010-01-01 01:01:03'}, table => $table1);
4013 4011
 $dbi->user_column_info($user_column_info);
4014 4012
 $dbi->type_rule(
4015
-    into1 => [
4016
-        [$date_typename, $datetime_typename] => sub {
4017
-            my $value = shift;
4018
-            $value =~ s/02/03/g;
4019
-            return $value;
4020
-        }
4021
-    ]
4013
+  into1 => [
4014
+    [$date_typename, $datetime_typename] => sub {
4015
+      my $value = shift;
4016
+      $value =~ s/02/03/g;
4017
+      return $value;
4018
+    }
4019
+  ]
4022 4020
 );
4023 4021
 $result = $dbi->execute(
4024
-    "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2",
4025
-    {$key1 => '2010-01-02', "$table1.$key2" => '2010-01-01 01:01:02'},
4026
-    table => $table1
4022
+  "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2",
4023
+  {$key1 => '2010-01-02', "$table1.$key2" => '2010-01-01 01:01:02'},
4024
+  table => $table1
4027 4025
 );
4028 4026
 $row = $result->one;
4029 4027
 like($row->{$key1}, qr/^2010-01-03/);
... ...
@@ -4033,18 +4031,18 @@ $dbi = DBIx::Custom->connect;
4033 4031
 eval { $dbi->execute("drop table $table1") };
4034 4032
 $dbi->execute($create_table1_type);
4035 4033
 $dbi->register_filter(convert => sub {
4036
-    my $value = shift || '';
4037
-    $value =~ s/02/03/;
4038
-    return $value;
4034
+  my $value = shift || '';
4035
+  $value =~ s/02/03/;
4036
+  return $value;
4039 4037
 });
4040 4038
 $dbi->user_column_info($user_column_info);
4041 4039
 $dbi->type_rule(
4042
-    from1 => {
4043
-        $date_datatype => 'convert',
4044
-    },
4045
-    into1 => {
4046
-        $date_typename => 'convert',
4047
-    }
4040
+  from1 => {
4041
+    $date_datatype => 'convert',
4042
+  },
4043
+  into1 => {
4044
+      $date_typename => 'convert',
4045
+  }
4048 4046
 );
4049 4047
 $dbi->insert({$key1 => '2010-02-02'}, table => $table1);
4050 4048
 $result = $dbi->select(table => $table1);
... ...
@@ -4060,21 +4058,21 @@ eval { $dbi->execute("drop table $table1") };
4060 4058
 $dbi->execute($create_table1_type);
4061 4059
 $dbi->user_column_info($user_column_info);
4062 4060
 $dbi->type_rule(
4063
-    into1 => {
4064
-        $date_typename => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4065
-    },
4066
-    into2 => {
4067
-        $date_typename => sub { my $v = shift || ''; $v =~ s/5/6/; return $v }
4068
-    },
4069
-    from1 => {
4070
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/6/7/; return $v }
4071
-    },
4072
-    from2 => {
4073
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/7/8/; return $v }
4074
-    }
4061
+  into1 => {
4062
+    $date_typename => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4063
+  },
4064
+  into2 => {
4065
+    $date_typename => sub { my $v = shift || ''; $v =~ s/5/6/; return $v }
4066
+  },
4067
+  from1 => {
4068
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/6/7/; return $v }
4069
+  },
4070
+  from2 => {
4071
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/7/8/; return $v }
4072
+  }
4075 4073
 );
4076 4074
 $dbi->insert({$key1 => '2010-01-03'}, 
4077
-  table => $table1, filter => {$key1 => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }});
4075
+table => $table1, filter => {$key1 => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }});
4078 4076
 $result = $dbi->select(table => $table1);
4079 4077
 $result->filter($key1 => sub { my $v = shift || ''; $v =~ s/8/9/; return $v });
4080 4078
 like($result->fetch_one->[0], qr/^2010-01-09/);
... ...
@@ -4085,23 +4083,23 @@ eval { $dbi->execute("drop table $table1") };
4085 4083
 $dbi->execute($create_table1_type);
4086 4084
 $dbi->user_column_info($user_column_info);
4087 4085
 $dbi->type_rule(
4088
-    from1 => {
4089
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4090
-    },
4091
-    from2 => {
4092
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4093
-    },
4086
+  from1 => {
4087
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4088
+  },
4089
+  from2 => {
4090
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4091
+  },
4094 4092
 );
4095 4093
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4096 4094
 $result = $dbi->select(table => $table1);
4097 4095
 $dbi->user_column_info($user_column_info);
4098 4096
 $result->type_rule(
4099
-    from1 => {
4100
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/6/; return $v }
4101
-    },
4102
-    from2 => {
4103
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/6/8/; return $v }
4104
-    }
4097
+  from1 => {
4098
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/6/; return $v }
4099
+  },
4100
+  from2 => {
4101
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/6/8/; return $v }
4102
+  }
4105 4103
 );
4106 4104
 $result->filter($key1 => sub { my $v = shift || ''; $v =~ s/8/9/; return $v });
4107 4105
 like($result->fetch_one->[0], qr/^2010-01-09/);
... ...
@@ -4112,12 +4110,12 @@ eval { $dbi->execute("drop table $table1") };
4112 4110
 $dbi->execute($create_table1_type);
4113 4111
 $dbi->user_column_info($user_column_info);
4114 4112
 $dbi->type_rule(
4115
-    from1 => {
4116
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4117
-    },
4118
-    into1 => {
4119
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4120
-    }
4113
+  from1 => {
4114
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4115
+  },
4116
+  into1 => {
4117
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4118
+  }
4121 4119
 );
4122 4120
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule_off => 1);
4123 4121
 $result = $dbi->select(table => $table1, type_rule_off => 1);
... ...
@@ -4128,12 +4126,12 @@ eval { $dbi->execute("drop table $table1") };
4128 4126
 $dbi->execute($create_table1_type);
4129 4127
 $dbi->user_column_info($user_column_info);
4130 4128
 $dbi->type_rule(
4131
-    from1 => {
4132
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4133
-    },
4134
-    into1 => {
4135
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4136
-    }
4129
+  from1 => {
4130
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4131
+  },
4132
+  into1 => {
4133
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4134
+  }
4137 4135
 );
4138 4136
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule_off => 1);
4139 4137
 $result = $dbi->select(table => $table1, type_rule_off => 1);
... ...
@@ -4144,12 +4142,12 @@ eval { $dbi->execute("drop table $table1") };
4144 4142
 $dbi->execute($create_table1_type);
4145 4143
 $dbi->user_column_info($user_column_info);
4146 4144
 $dbi->type_rule(
4147
-    from1 => {
4148
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4149
-    },
4150
-    into1 => {
4151
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4152
-    }
4145
+  from1 => {
4146
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4147
+  },
4148
+  into1 => {
4149
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4150
+  }
4153 4151
 );
4154 4152
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4155 4153
 $result = $dbi->select(table => $table1);
... ...
@@ -4160,12 +4158,12 @@ eval { $dbi->execute("drop table $table1") };
4160 4158
 $dbi->execute($create_table1_type);
4161 4159
 $dbi->user_column_info($user_column_info);
4162 4160
 $dbi->type_rule(
4163
-    from1 => {
4164
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4165
-    },
4166
-    into1 => {
4167
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4168
-    }
4161
+  from1 => {
4162
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4163
+  },
4164
+  into1 => {
4165
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4166
+  }
4169 4167
 );
4170 4168
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4171 4169
 $result = $dbi->select(table => $table1);
... ...
@@ -4177,18 +4175,18 @@ $dbi->execute($create_table1_type);
4177 4175
 $dbi->register_filter(ppp => sub { my $v = shift || ''; $v =~ s/3/4/; return $v });
4178 4176
 $dbi->user_column_info($user_column_info);
4179 4177
 $dbi->type_rule(
4180
-    into1 => {
4181
-        $date_typename => 'ppp'
4182
-    }
4178
+  into1 => {
4179
+    $date_typename => 'ppp'
4180
+  }
4183 4181
 );
4184 4182
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4185 4183
 $result = $dbi->select(table => $table1);
4186 4184
 like($result->one->{$key1}, qr/^2010-01-04/);
4187 4185
 
4188 4186
 eval{$dbi->type_rule(
4189
-    into1 => {
4190
-        $date_typename => 'pp'
4191
-    }
4187
+  into1 => {
4188
+    $date_typename => 'pp'
4189
+  }
4192 4190
 )};
4193 4191
 like($@, qr/not registered/);
4194 4192
 
... ...
@@ -4196,20 +4194,20 @@ $dbi = DBIx::Custom->connect;
4196 4194
 eval { $dbi->execute("drop table $table1") };
4197 4195
 $dbi->execute($create_table1_type);
4198 4196
 eval {
4199
-    $dbi->type_rule(
4200
-        from1 => {
4201
-            Date => sub { $_[0] * 2 },
4202
-        }
4203
-    );
4197
+  $dbi->type_rule(
4198
+    from1 => {
4199
+      Date => sub { $_[0] * 2 },
4200
+    }
4201
+  );
4204 4202
 };
4205 4203
 like($@, qr/lower/);
4206 4204
 
4207 4205
 eval {
4208
-    $dbi->type_rule(
4209
-        into1 => {
4210
-            Date => sub { $_[0] * 2 },
4211
-        }
4212
-    );
4206
+  $dbi->type_rule(
4207
+    into1 => {
4208
+      Date => sub { $_[0] * 2 },
4209
+    }
4210
+  );
4213 4211
 };
4214 4212
 like($@, qr/lower/);
4215 4213
 
... ...
@@ -4218,12 +4216,12 @@ eval { $dbi->execute("drop table $table1") };
4218 4216
 $dbi->execute($create_table1_type);
4219 4217
 $dbi->user_column_info($user_column_info);
4220 4218
 $dbi->type_rule(
4221
-    from1 => {
4222
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4223
-    },
4224
-    into1 => {
4225
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4226
-    }
4219
+  from1 => {
4220
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/4/5/; return $v }
4221
+  },
4222
+  into1 => {
4223
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4224
+  }
4227 4225
 );
4228 4226
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4229 4227
 $result = $dbi->select(table => $table1);
... ...
@@ -4235,17 +4233,17 @@ eval { $dbi->execute("drop table $table1") };
4235 4233
 $dbi->execute($create_table1_type);
4236 4234
 $dbi->user_column_info($user_column_info);
4237 4235
 $dbi->type_rule(
4238
-    from1 => {
4239
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v },
4240
-        $datetime_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4241
-    },
4236
+  from1 => {
4237
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v },
4238
+    $datetime_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4239
+  },
4242 4240
 );
4243 4241
 $dbi->insert({$key1 => '2010-01-03', $key2 => '2010-01-01 01:01:03'}, table => $table1);
4244 4242
 $result = $dbi->select(table => $table1);
4245 4243
 $result->type_rule(
4246
-    from1 => {
4247
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4248
-    }
4244
+  from1 => {
4245
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4246
+  }
4249 4247
 );
4250 4248
 $row = $result->one;
4251 4249
 like($row->{$key1}, qr/^2010-01-05/);
... ...
@@ -4253,9 +4251,9 @@ like($row->{$key2}, qr/^2010-01-01 01:01:03/);
4253 4251
 
4254 4252
 $result = $dbi->select(table => $table1);
4255 4253
 $result->type_rule(
4256
-    from1 => {
4257
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4258
-    }
4254
+  from1 => {
4255
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4256
+  }
4259 4257
 );
4260 4258
 $row = $result->one;
4261 4259
 like($row->{$key1}, qr/2010-01-05/);
... ...
@@ -4263,9 +4261,9 @@ like($row->{$key2}, qr/2010-01-01 01:01:03/);
4263 4261
 
4264 4262
 $result = $dbi->select(table => $table1);
4265 4263
 $result->type_rule(
4266
-    from1 => {
4267
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4268
-    }
4264
+  from1 => {
4265
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4266
+  }
4269 4267
 );
4270 4268
 $row = $result->one;
4271 4269
 like($row->{$key1}, qr/2010-01-05/);
... ...
@@ -4273,7 +4271,7 @@ like($row->{$key2}, qr/2010-01-01 01:01:03/);
4273 4271
 
4274 4272
 $result = $dbi->select(table => $table1);
4275 4273
 $result->type_rule(
4276
-    from1 => [$date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }]
4274
+  from1 => [$date_datatype => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }]
4277 4275
 );
4278 4276
 $row = $result->one;
4279 4277
 like($row->{$key1}, qr/2010-01-05/);
... ...
@@ -4282,7 +4280,7 @@ like($row->{$key2}, qr/2010-01-01 01:01:03/);
4282 4280
 $dbi->register_filter(five => sub { my $v = shift || ''; $v =~ s/3/5/; return $v });
4283 4281
 $result = $dbi->select(table => $table1);
4284 4282
 $result->type_rule(
4285
-    from1 => [$date_datatype => 'five']
4283
+  from1 => [$date_datatype => 'five']
4286 4284
 );
4287 4285
 $row = $result->one;
4288 4286
 like($row->{$key1}, qr/^2010-01-05/);
... ...
@@ -4290,7 +4288,7 @@ like($row->{$key2}, qr/^2010-01-01 01:01:03/);
4290 4288
 
4291 4289
 $result = $dbi->select(table => $table1);
4292 4290
 $result->type_rule(
4293
-    from1 => [$date_datatype => undef]
4291
+  from1 => [$date_datatype => undef]
4294 4292
 );
4295 4293
 $row = $result->one;
4296 4294
 like($row->{$key1}, qr/^2010-01-03/);
... ...
@@ -4301,9 +4299,9 @@ eval { $dbi->execute("drop table $table1") };
4301 4299
 $dbi->execute($create_table1_type);
4302 4300
 $dbi->user_column_info($user_column_info);
4303 4301
 $dbi->type_rule(
4304
-    from1 => {
4305
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v },
4306
-    },
4302
+  from1 => {
4303
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v },
4304
+  },
4307 4305
 );
4308 4306
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4309 4307
 $result = $dbi->select(table => $table1);
... ...
@@ -4315,9 +4313,9 @@ eval { $dbi->execute("drop table $table1") };
4315 4313
 $dbi->execute($create_table1_type);
4316 4314
 $dbi->user_column_info($user_column_info);
4317 4315
 $dbi->type_rule(
4318
-    from1 => {
4319
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4320
-    },
4316
+  from1 => {
4317
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4318
+  },
4321 4319
 );
4322 4320
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1);
4323 4321
 $result = $dbi->select(table => $table1);
... ...
@@ -4329,18 +4327,18 @@ eval { $dbi->execute("drop table $table1") };
4329 4327
 $dbi->execute($create_table1_type);
4330 4328
 $dbi->user_column_info($user_column_info);
4331 4329
 $dbi->type_rule(
4332
-    into1 => {
4333
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4334
-    },
4335
-    into2 => {
4336
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4337
-    },
4338
-    from1 => {
4339
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/3/6/; return $v }
4340
-    },
4341
-    from2 => {
4342
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|6)/7/; return $v }
4343
-    }
4330
+  into1 => {
4331
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4332
+  },
4333
+  into2 => {
4334
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4335
+  },
4336
+  from1 => {
4337
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/3/6/; return $v }
4338
+  },
4339
+  from2 => {
4340
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|6)/7/; return $v }
4341
+  }
4344 4342
 );
4345 4343
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule_off => 1);
4346 4344
 $result = $dbi->select(table => $table1);
... ...
@@ -4353,18 +4351,18 @@ eval { $dbi->execute("drop table $table1") };
4353 4351
 $dbi->execute($create_table1_type);
4354 4352
 $dbi->user_column_info($user_column_info);
4355 4353
 $dbi->type_rule(
4356
-    into1 => {
4357
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4358
-    },
4359
-    into2 => {
4360
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4361
-    },
4362
-    from1 => {
4363
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|5)/6/; return $v }
4364
-    },
4365
-    from2 => {
4366
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/6/7/; return $v }
4367
-    }
4354
+  into1 => {
4355
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4356
+  },
4357
+  into2 => {
4358
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4359
+  },
4360
+  from1 => {
4361
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|5)/6/; return $v }
4362
+  },
4363
+  from2 => {
4364
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/6/7/; return $v }
4365
+  }
4368 4366
 );
4369 4367
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule1_off => 1);
4370 4368
 $result = $dbi->select(table => $table1);
... ...
@@ -4377,18 +4375,18 @@ eval { $dbi->execute("drop table $table1") };
4377 4375
 $dbi->execute($create_table1_type);
4378 4376
 $dbi->user_column_info($user_column_info);
4379 4377
 $dbi->type_rule(
4380
-    into1 => {
4381
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4382
-    },
4383
-    into2 => {
4384
-        $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4385
-    },
4386
-    from1 => {
4387
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/5/6/; return $v }
4388
-    },
4389
-    from2 => {
4390
-        $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|6)/7/; return $v }
4391
-    }
4378
+  into1 => {
4379
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/5/; return $v }
4380
+  },
4381
+  into2 => {
4382
+    $date_typename => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }
4383
+  },
4384
+  from1 => {
4385
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/5/6/; return $v }
4386
+  },
4387
+  from2 => {
4388
+    $date_datatype => sub { my $v = shift || ''; $v =~ s/(3|6)/7/; return $v }
4389
+  }
4392 4390
 );
4393 4391
 $dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule2_off => 1);
4394 4392
 $result = $dbi->select(table => $table1);
... ...
@@ -4409,10 +4407,10 @@ eval { $dbi->execute("drop table $table3") };
4409 4407
 $dbi->execute("create table $table3 ($key3 int, $key4 int)");
4410 4408
 $dbi->insert({$key3 => 5, $key4 => 4}, table => $table3);
4411 4409
 $rows = $dbi->select(
4412
-    table => $table1,
4413
-    column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
4414
-    where   => {"$table1.$key2" => 2},
4415
-    join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1"]
4410
+  table => $table1,
4411
+  column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
4412
+  where   => {"$table1.$key2" => 2},
4413
+  join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1"]
4416 4414
 )->all;
4417 4415
 is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}]);
4418 4416
 
... ...
@@ -4428,46 +4426,46 @@ eval { $dbi->execute("drop table $table3") };
4428 4426
 $dbi->execute("create table $table3 ($key3 int, $key4 int)");
4429 4427
 $dbi->insert({$key3 => 5, $key4 => 4}, table => $table3);
4430 4428
 $rows = $dbi->select(
4431
-    table => $table1,
4432
-    column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
4433
-    where   => {"$table1.$key2" => 2},
4434
-    join  => {
4435
-        clause => "left outer join $table2 on $table1.$key1 = $table2.$key1",
4436
-        table => [$table1, $table2]
4437
-    }
4429
+  table => $table1,
4430
+  column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3",
4431
+  where   => {"$table1.$key2" => 2},
4432
+  join  => {
4433
+    clause => "left outer join $table2 on $table1.$key1 = $table2.$key1",
4434
+    table => [$table1, $table2]
4435
+  }
4438 4436
 )->all;
4439 4437
 is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}]);
4440 4438
 
4441 4439
 $rows = $dbi->select(
4442
-    table => $table1,
4443
-    where   => {$key1 => 1},
4444
-    join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1"]
4440
+  table => $table1,
4441
+  where   => {$key1 => 1},
4442
+  join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1"]
4445 4443
 )->all;
4446 4444
 is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
4447 4445
 
4448 4446
 $rows = $dbi->select(
4449
-    table => $table1,
4450
-    where   => {$key1 => 1},
4451
-    join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4452
-              "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4447
+  table => $table1,
4448
+  where   => {$key1 => 1},
4449
+  join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4450
+            "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4453 4451
 )->all;
4454 4452
 is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
4455 4453
 
4456 4454
 $rows = $dbi->select(
4457
-    column => "$table3.$key4 as ${table3}__$key4",
4458
-    table => $table1,
4459
-    where   => {"$table1.$key1" => 1},
4460
-    join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4461
-              "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4455
+  column => "$table3.$key4 as ${table3}__$key4",
4456
+  table => $table1,
4457
+  where   => {"$table1.$key1" => 1},
4458
+  join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4459
+            "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4462 4460
 )->all;
4463 4461
 is_deeply($rows, [{"${table3}__$key4" => 4}]);
4464 4462
 
4465 4463
 $rows = $dbi->select(
4466
-    column => "$table1.$key1 as ${table1}__$key1",
4467
-    table => $table1,
4468
-    where   => {"$table3.$key4" => 4},
4469
-    join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4470
-              "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4464
+  column => "$table1.$key1 as ${table1}__$key1",
4465
+  table => $table1,
4466
+  where   => {"$table3.$key4" => 4},
4467
+  join  => ["left outer join $table2 on $table1.$key1 = $table2.$key1",
4468
+            "left outer join $table3 on $table2.$key3 = $table3.$key3"]
4471 4469
 )->all;
4472 4470
 is_deeply($rows, [{"${table1}__$key1" => 1}]);
4473 4471
 
... ...
@@ -4479,13 +4477,13 @@ eval { $dbi->execute("drop table $table2") };
4479 4477
 $dbi->execute($create_table2);
4480 4478
 $dbi->insert({$key1 => 1, $key3 => 5}, table => $table2);
4481 4479
 $rows = $dbi->select(
4482
-    table => $table1,
4483
-    column => "${q}$table1$p.${q}$key1$p as ${q}${table1}_$key1$p, ${q}$table2$p.${q}$key1$p as ${q}${table2}_$key1$p, ${q}$key2$p, ${q}$key3$p",
4484
-    where   => {"$table1.$key2" => 2},
4485
-    join  => ["left outer join ${q}$table2$p on ${q}$table1$p.${q}$key1$p = ${q}$table2$p.${q}$key1$p"],
4480
+  table => $table1,
4481
+  column => "${q}$table1$p.${q}$key1$p as ${q}${table1}_$key1$p, ${q}$table2$p.${q}$key1$p as ${q}${table2}_$key1$p, ${q}$key2$p, ${q}$key3$p",
4482
+  where   => {"$table1.$key2" => 2},
4483
+  join  => ["left outer join ${q}$table2$p on ${q}$table1$p.${q}$key1$p = ${q}$table2$p.${q}$key1$p"],
4486 4484
 )->all;
4487 4485
 is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}],
4488
-          'quote');
4486
+  'quote');
4489 4487
 
4490 4488
 
4491 4489
 $dbi = DBIx::Custom->connect;
... ...
@@ -4494,18 +4492,18 @@ $dbi->execute($create_table1);
4494 4492
 $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
4495 4493
 $sql = <<"EOS";
4496 4494
 left outer join (
4497
-  select * from $table1 t1
4498
-  where t1.$key2 = (
4499
-    select max(t2.$key2) from $table1 t2
4500
-    where t1.$key1 = t2.$key1
4501
-  )
4495
+select * from $table1 t1
4496
+where t1.$key2 = (
4497
+  select max(t2.$key2) from $table1 t2
4498
+  where t1.$key1 = t2.$key1
4499
+)
4502 4500
 ) $table3 on $table1.$key1 = $table3.$key1
4503 4501
 EOS
4504 4502
 $join = [$sql];
4505 4503
 $rows = $dbi->select(
4506
-    table => $table1,
4507
-    column => "$table3.$key1 as ${table3}__$key1",
4508
-    join  => $join
4504
+  table => $table1,
4505
+  column => "$table3.$key1 as ${table3}__$key1",
4506
+  join  => $join
4509 4507
 )->all;
4510 4508
 is_deeply($rows, [{"${table3}__$key1" => 1}]);
4511 4509
 
... ...
@@ -4518,26 +4516,26 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
4518 4516
 $dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
4519 4517
 $dbi->insert({$key1 => 1, $key3 => 5}, table => $table2);
4520 4518
 $result = $dbi->select(
4521
-    table => $table1,
4522
-    join => [
4523
-        "left outer join $table2 on $table2.$key2 = '4' and $table1.$key1 = $table2.$key1"
4524
-    ]
4519
+  table => $table1,
4520
+  join => [
4521
+    "left outer join $table2 on $table2.$key2 = '4' and $table1.$key1 = $table2.$key1"
4522
+  ]
4525 4523
 );
4526 4524
 is_deeply($result->all, [{$key1 => 1, $key2 => 2}]);
4527 4525
 $result = $dbi->select(
4528
-    table => $table1,
4529
-    column => [{$table2 => [$key3]}],
4530
-    join => [
4531
-        "left outer join $table2 on $table2.$key3 = '4' and $table1.$key1 = $table2.$key1"
4532
-    ]
4526
+  table => $table1,
4527
+  column => [{$table2 => [$key3]}],
4528
+  join => [
4529
+    "left outer join $table2 on $table2.$key3 = '4' and $table1.$key1 = $table2.$key1"
4530
+  ]
4533 4531
 );
4534 4532
 is_deeply($result->all, [{"$table2.$key3" => 4}]);
4535 4533
 $result = $dbi->select(
4536
-    table => $table1,
4537
-    column => [{$table2 => [$key3]}],
4538
-    join => [
4539
-        "left outer join $table2 on $table1.$key1 = $table2.$key1 and $table2.$key3 = '4'"
4540
-    ]
4534
+  table => $table1,
4535
+  column => [{$table2 => [$key3]}],
4536
+  join => [
4537
+    "left outer join $table2 on $table1.$key1 = $table2.$key1 and $table2.$key3 = '4'"
4538
+  ]
4541 4539
 );
4542 4540
 is_deeply($result->all, [{"$table2.$key3" => 4}]);
4543 4541
 
... ...
@@ -4550,14 +4548,14 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
4550 4548
 $dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
4551 4549
 $dbi->insert({$key1 => 1, $key3 => 5}, table => $table2);
4552 4550
 $result = $dbi->select(
4553
-    table => $table1,
4554
-    column => [{$table2 => [$key3]}],
4555
-    join => [
4556
-        {
4557
-            clause => "left outer join $table2 on $table2.$key3 = '4' and $table1.$key1 = $table2.$key1",
4558
-            table => [$table1, $table2]
4559
-        }
4560
-    ]
4551
+  table => $table1,
4552
+  column => [{$table2 => [$key3]}],
4553
+  join => [
4554
+    {
4555
+      clause => "left outer join $table2 on $table2.$key3 = '4' and $table1.$key1 = $table2.$key1",
4556
+      table => [$table1, $table2]
4557
+    }
4558
+  ]
4561 4559
 );
4562 4560
 is_deeply($result->all, [{"$table2.$key3" => 4}]);
4563 4561
 
... ...
@@ -4570,11 +4568,11 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
4570 4568
 $dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
4571 4569
 $dbi->insert({$key1 => 1, $key3 => 1}, table => $table2);
4572 4570
 $result = $dbi->select(
4573
-    table => $table1,
4574
-    column => [{$table2 => [$key3]}],
4575
-    join => [
4576
-        "left outer join $table2 on $table1.$key1 = $table2.$key1 and $table2.$key3 > '3'"
4577
-    ]
4571
+  table => $table1,
4572
+  column => [{$table2 => [$key3]}],
4573
+  join => [
4574
+    "left outer join $table2 on $table1.$key1 = $table2.$key1 and $table2.$key3 > '3'"
4575
+  ]
4578 4576
 );
4579 4577
 is_deeply($result->all, [{"$table2.$key3" => 4}]);
4580 4578
 
... ...
@@ -4587,11 +4585,11 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
4587 4585
 $dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
4588 4586
 $dbi->insert({$key1 => 1, $key3 => 1}, table => $table2);
4589 4587
 $result = $dbi->select(
4590
-    table => $table1,
4591
-    column => [{$table2 => [$key3]}],
4592
-    join => [
4593
-        "left outer join $table2 on $table2.$key3 > '3' and $table1.$key1 = $table2.$key1"
4594
-    ]
4588
+  table => $table1,
4589
+  column => [{$table2 => [$key3]}],
4590
+  join => [
4591
+    "left outer join $table2 on $table2.$key3 > '3' and $table1.$key1 = $table2.$key1"
4592
+  ]
4595 4593
 );
4596 4594
 is_deeply($result->all, [{"$table2.$key3" => 4}]);
4597 4595
 
... ...
@@ -4617,7 +4615,7 @@ $dbi->execute($create_table2);
4617 4615
 $model = $dbi->create_model(table => $table1, primary_key => $key1);
4618 4616
 $model->insert({$key1 => 1, $key2 => 2});
4619 4617
 $model = $dbi->create_model(table => $table2, primary_key => $key1,
4620
-    join => ["left outer join $table1 on $table2.$key1 = $table1.$key1"]);
4618
+  join => ["left outer join $table1 on $table2.$key1 = $table1.$key1"]);
4621 4619
 $model->insert({$key1 => 1, $key3 => 3});
4622 4620
 is($model->count(id => 1), 1);
4623 4621
 is($model->count(where => {"$table2.$key3" => 3}), 1);
+3 -3
t/sqlite-quote.t
... ...
@@ -1,9 +1,9 @@
1 1
 # Change quote for tests
2 2
 use DBIx::Custom;
3 3
 {
4
-    package DBIx::Custom;
5
-    no warnings 'redefine';
6
-    sub quote { '""' }
4
+  package DBIx::Custom;
5
+  no warnings 'redefine';
6
+  sub quote { '""' }
7 7
 }
8 8
 
9 9
 use FindBin;