| ... | ... | 
                  @@ -1684,4 +1684,98 @@ like($@, qr/table/);  | 
              
| 1684 | 1684 | 
                   eval {$dbi->select};
                 | 
              
| 1685 | 1685 | 
                  like($@, qr/table/);  | 
              
| 1686 | 1686 | 
                   | 
              
| 1687 | 
                  +test 'more tests';  | 
              |
| 1688 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1689 | 
                  +eval{$dbi->apply_filter('table', 'column', [])};
                 | 
              |
| 1690 | 
                  +like($@, qr/apply_filter/);  | 
              |
| 1691 | 
                  +  | 
              |
| 1692 | 
                  +eval{$dbi->apply_filter('table', 'column', {outer => 2})};
                 | 
              |
| 1693 | 
                  +like($@, qr/apply_filter/);  | 
              |
| 1694 | 
                  +  | 
              |
| 1695 | 
                  +$dbi->apply_filter(  | 
              |
| 1696 | 
                  +  | 
              |
| 1697 | 
                  +);  | 
              |
| 1698 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1699 | 
                  +eval { $dbi->execute('drop table table1') };
                 | 
              |
| 1700 | 
                  +$dbi->execute($create_table1);  | 
              |
| 1701 | 
                  +$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
                 | 
              |
| 1702 | 
                  +$dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
                 | 
              |
| 1703 | 
                  +$dbi->apply_filter('table1', 'key2', 
                 | 
              |
| 1704 | 
                  +                   {in => sub { $_[0] * 3 }, out => sub { $_[0] * 2 }});
                 | 
              |
| 1705 | 
                  +$rows = $dbi->select(table => 'table1', where => {key2 => 1})->all;
                 | 
              |
| 1706 | 
                  +is_deeply($rows, [{key1 => 1, key2 => 6}]);
                 | 
              |
| 1707 | 
                  +  | 
              |
| 1708 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1709 | 
                  +eval { $dbi->execute('drop table table1') };
                 | 
              |
| 1710 | 
                  +$dbi->execute($create_table1);  | 
              |
| 1711 | 
                  +$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
                 | 
              |
| 1712 | 
                  +$dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
                 | 
              |
| 1713 | 
                  +$dbi->apply_filter('table1', 'key2', {});
                 | 
              |
| 1714 | 
                  +$rows = $dbi->select(table => 'table1', where => {key2 => 2})->all;
                 | 
              |
| 1715 | 
                  +is_deeply($rows, [{key1 => 1, key2 => 2}]);
                 | 
              |
| 1716 | 
                  +  | 
              |
| 1717 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1718 | 
                  +eval {$dbi->apply_filter('table1', 'key2', {out => 'no'})};
                 | 
              |
| 1719 | 
                  +like($@, qr/not registered/);  | 
              |
| 1720 | 
                  +eval {$dbi->apply_filter('table1', 'key2', {in => 'no'})};
                 | 
              |
| 1721 | 
                  +like($@, qr/not registered/);  | 
              |
| 1722 | 
                  +$dbi->method({one => sub { 1 }});
                 | 
              |
| 1723 | 
                  +is($dbi->one, 1);  | 
              |
| 1724 | 
                  +  | 
              |
| 1725 | 
                  +eval{DBIx::Custom->connect(dsn => undef)};
                 | 
              |
| 1726 | 
                  +like($@, qr/_connect/);  | 
              |
| 1727 | 
                  +  | 
              |
| 1728 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1729 | 
                  +eval { $dbi->execute('drop table table1') };
                 | 
              |
| 1730 | 
                  +$dbi->execute($create_table1);  | 
              |
| 1731 | 
                  +$dbi->register_filter(twice => sub { $_[0] * 2 });
                 | 
              |
| 1732 | 
                  +$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2},
                 | 
              |
| 1733 | 
                  +             filter => {key1 => 'twice'});
                 | 
              |
| 1734 | 
                  +$row = $dbi->select(table => 'table1')->one;  | 
              |
| 1735 | 
                  +is_deeply($row, {key1 => 2, key2 => 2});
                 | 
              |
| 1736 | 
                  +eval {$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2},
                 | 
              |
| 1737 | 
                  +             filter => {key1 => 'no'}) };
                 | 
              |
| 1738 | 
                  +like($@, qr//);  | 
              |
| 1739 | 
                  +  | 
              |
| 1740 | 
                  +$dbi->register_filter(one => sub { });
                 | 
              |
| 1741 | 
                  +$dbi->default_fetch_filter('one');
                 | 
              |
| 1742 | 
                  +ok($dbi->default_fetch_filter);  | 
              |
| 1743 | 
                  +$dbi->default_bind_filter('one');
                 | 
              |
| 1744 | 
                  +ok($dbi->default_bind_filter);  | 
              |
| 1745 | 
                  +eval{$dbi->default_fetch_filter('no')};
                 | 
              |
| 1746 | 
                  +like($@, qr/not registered/);  | 
              |
| 1747 | 
                  +eval{$dbi->default_bind_filter('no')};
                 | 
              |
| 1748 | 
                  +like($@, qr/not registered/);  | 
              |
| 1749 | 
                  +$dbi->default_bind_filter(undef);  | 
              |
| 1750 | 
                  +ok(!defined $dbi->default_bind_filter);  | 
              |
| 1751 | 
                  +$dbi->default_fetch_filter(undef);  | 
              |
| 1752 | 
                  +ok(!defined $dbi->default_fetch_filter);  | 
              |
| 1753 | 
                  +eval {$dbi->execute('select * from table1 {} {= author') };
                 | 
              |
| 1754 | 
                  +like($@, qr/Tag not finished/);  | 
              |
| 1755 | 
                  +  | 
              |
| 1756 | 
                  +$dbi = DBIx::Custom->connect;  | 
              |
| 1757 | 
                  +eval { $dbi->execute('drop table table1') };
                 | 
              |
| 1758 | 
                  +$dbi->execute($create_table1);  | 
              |
| 1759 | 
                  +$dbi->register_filter(one => sub { 1 });
                 | 
              |
| 1760 | 
                  +$result = $dbi->select(table => 'table1');  | 
              |
| 1761 | 
                  +eval {$result->filter(key1 => 'no')};
                 | 
              |
| 1762 | 
                  +like($@, qr/not registered/);  | 
              |
| 1763 | 
                  +eval {$result->end_filter(key1 => 'no')};
                 | 
              |
| 1764 | 
                  +like($@, qr/not registered/);  | 
              |
| 1765 | 
                  +$result->default_filter(undef);  | 
              |
| 1766 | 
                  +ok(!defined $result->default_filter);  | 
              |
| 1767 | 
                  +$result->default_filter('one');
                 | 
              |
| 1768 | 
                  +is($result->default_filter->(), 1);  | 
              |
| 1769 | 
                  +  | 
              |
| 1770 | 
                  +test 'dbi_option';  | 
              |
| 1771 | 
                  +$dbi = DBIx::Custom->connect(dbi_option => {PrintError => 1});
                 | 
              |
| 1772 | 
                  +ok($dbi->dbh->{PrintError});
                 | 
              |
| 1773 | 
                  +$dbi = DBIx::Custom->connect(dbi_options => {PrintError => 1});
                 | 
              |
| 1774 | 
                  +ok($dbi->dbh->{PrintError});
                 | 
              |
| 1775 | 
                  +  | 
              |
| 1776 | 
                  +test 'DBIx::Custom::Result stash()';  | 
              |
| 1777 | 
                  +$result = DBIx::Custom::Result->new;  | 
              |
| 1778 | 
                  +is_deeply($result->stash, {}, 'default');
                 | 
              |
| 1779 | 
                  +$result->stash->{foo} = 1;
                 | 
              |
| 1780 | 
                  +is($result->stash->{foo}, 1, 'get and set');
                 | 
              |
| 1687 | 1781 | 
                  1;  | 
              
| ... | ... | 
                  @@ -70,105 +70,6 @@ my $binary;  | 
              
| 70 | 70 | 
                  # Prepare table  | 
              
| 71 | 71 | 
                  $dbi = DBIx::Custom->connect;  | 
              
| 72 | 72 | 
                   | 
              
| 73 | 
                  -  | 
              |
| 74 | 
                  -  | 
              |
| 75 | 
                  -  | 
              |
| 76 | 
                  -test 'more tests';  | 
              |
| 77 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 78 | 
                  -eval{$dbi->apply_filter('table', 'column', [])};
                 | 
              |
| 79 | 
                  -like($@, qr/apply_filter/);  | 
              |
| 80 | 
                  -  | 
              |
| 81 | 
                  -eval{$dbi->apply_filter('table', 'column', {outer => 2})};
                 | 
              |
| 82 | 
                  -like($@, qr/apply_filter/);  | 
              |
| 83 | 
                  -  | 
              |
| 84 | 
                  -$dbi->apply_filter(  | 
              |
| 85 | 
                  -  | 
              |
| 86 | 
                  -);  | 
              |
| 87 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 88 | 
                  -eval { $dbi->execute('drop table table1') };
                 | 
              |
| 89 | 
                  -$dbi->execute($create_table1);  | 
              |
| 90 | 
                  -$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
                 | 
              |
| 91 | 
                  -$dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
                 | 
              |
| 92 | 
                  -$dbi->apply_filter('table1', 'key2', 
                 | 
              |
| 93 | 
                  -                   {in => sub { $_[0] * 3 }, out => sub { $_[0] * 2 }});
                 | 
              |
| 94 | 
                  -$rows = $dbi->select(table => 'table1', where => {key2 => 1})->all;
                 | 
              |
| 95 | 
                  -is_deeply($rows, [{key1 => 1, key2 => 6}]);
                 | 
              |
| 96 | 
                  -  | 
              |
| 97 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 98 | 
                  -eval { $dbi->execute('drop table table1') };
                 | 
              |
| 99 | 
                  -$dbi->execute($create_table1);  | 
              |
| 100 | 
                  -$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
                 | 
              |
| 101 | 
                  -$dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
                 | 
              |
| 102 | 
                  -$dbi->apply_filter('table1', 'key2', {});
                 | 
              |
| 103 | 
                  -$rows = $dbi->select(table => 'table1', where => {key2 => 2})->all;
                 | 
              |
| 104 | 
                  -is_deeply($rows, [{key1 => 1, key2 => 2}]);
                 | 
              |
| 105 | 
                  -  | 
              |
| 106 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 107 | 
                  -eval {$dbi->apply_filter('table1', 'key2', {out => 'no'})};
                 | 
              |
| 108 | 
                  -like($@, qr/not registered/);  | 
              |
| 109 | 
                  -eval {$dbi->apply_filter('table1', 'key2', {in => 'no'})};
                 | 
              |
| 110 | 
                  -like($@, qr/not registered/);  | 
              |
| 111 | 
                  -$dbi->method({one => sub { 1 }});
                 | 
              |
| 112 | 
                  -is($dbi->one, 1);  | 
              |
| 113 | 
                  -  | 
              |
| 114 | 
                  -eval{DBIx::Custom->connect(dsn => undef)};
                 | 
              |
| 115 | 
                  -like($@, qr/_connect/);  | 
              |
| 116 | 
                  -  | 
              |
| 117 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 118 | 
                  -eval { $dbi->execute('drop table table1') };
                 | 
              |
| 119 | 
                  -$dbi->execute($create_table1);  | 
              |
| 120 | 
                  -$dbi->register_filter(twice => sub { $_[0] * 2 });
                 | 
              |
| 121 | 
                  -$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2},
                 | 
              |
| 122 | 
                  -             filter => {key1 => 'twice'});
                 | 
              |
| 123 | 
                  -$row = $dbi->select(table => 'table1')->one;  | 
              |
| 124 | 
                  -is_deeply($row, {key1 => 2, key2 => 2});
                 | 
              |
| 125 | 
                  -eval {$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2},
                 | 
              |
| 126 | 
                  -             filter => {key1 => 'no'}) };
                 | 
              |
| 127 | 
                  -like($@, qr//);  | 
              |
| 128 | 
                  -  | 
              |
| 129 | 
                  -$dbi->register_filter(one => sub { });
                 | 
              |
| 130 | 
                  -$dbi->default_fetch_filter('one');
                 | 
              |
| 131 | 
                  -ok($dbi->default_fetch_filter);  | 
              |
| 132 | 
                  -$dbi->default_bind_filter('one');
                 | 
              |
| 133 | 
                  -ok($dbi->default_bind_filter);  | 
              |
| 134 | 
                  -eval{$dbi->default_fetch_filter('no')};
                 | 
              |
| 135 | 
                  -like($@, qr/not registered/);  | 
              |
| 136 | 
                  -eval{$dbi->default_bind_filter('no')};
                 | 
              |
| 137 | 
                  -like($@, qr/not registered/);  | 
              |
| 138 | 
                  -$dbi->default_bind_filter(undef);  | 
              |
| 139 | 
                  -ok(!defined $dbi->default_bind_filter);  | 
              |
| 140 | 
                  -$dbi->default_fetch_filter(undef);  | 
              |
| 141 | 
                  -ok(!defined $dbi->default_fetch_filter);  | 
              |
| 142 | 
                  -eval {$dbi->execute('select * from table1 {} {= author') };
                 | 
              |
| 143 | 
                  -like($@, qr/Tag not finished/);  | 
              |
| 144 | 
                  -  | 
              |
| 145 | 
                  -$dbi = DBIx::Custom->connect;  | 
              |
| 146 | 
                  -eval { $dbi->execute('drop table table1') };
                 | 
              |
| 147 | 
                  -$dbi->execute($create_table1);  | 
              |
| 148 | 
                  -$dbi->register_filter(one => sub { 1 });
                 | 
              |
| 149 | 
                  -$result = $dbi->select(table => 'table1');  | 
              |
| 150 | 
                  -eval {$result->filter(key1 => 'no')};
                 | 
              |
| 151 | 
                  -like($@, qr/not registered/);  | 
              |
| 152 | 
                  -eval {$result->end_filter(key1 => 'no')};
                 | 
              |
| 153 | 
                  -like($@, qr/not registered/);  | 
              |
| 154 | 
                  -$result->default_filter(undef);  | 
              |
| 155 | 
                  -ok(!defined $result->default_filter);  | 
              |
| 156 | 
                  -$result->default_filter('one');
                 | 
              |
| 157 | 
                  -is($result->default_filter->(), 1);  | 
              |
| 158 | 
                  -  | 
              |
| 159 | 
                  -test 'dbi_option';  | 
              |
| 160 | 
                  -$dbi = DBIx::Custom->connect(dbi_option => {PrintError => 1});
                 | 
              |
| 161 | 
                  -ok($dbi->dbh->{PrintError});
                 | 
              |
| 162 | 
                  -$dbi = DBIx::Custom->connect(dbi_options => {PrintError => 1});
                 | 
              |
| 163 | 
                  -ok($dbi->dbh->{PrintError});
                 | 
              |
| 164 | 
                  -  | 
              |
| 165 | 
                  -test 'DBIx::Custom::Result stash()';  | 
              |
| 166 | 
                  -$result = DBIx::Custom::Result->new;  | 
              |
| 167 | 
                  -is_deeply($result->stash, {}, 'default');
                 | 
              |
| 168 | 
                  -$result->stash->{foo} = 1;
                 | 
              |
| 169 | 
                  -is($result->stash->{foo}, 1, 'get and set');
                 | 
              |
| 170 | 
                  -  | 
              |
| 171 | 
                  -  | 
              |
| 172 | 73 | 
                  test 'Model class';  | 
              
| 173 | 74 | 
                  use MyDBI1;  | 
              
| 174 | 75 | 
                  $dbi = MyDBI1->connect;  |