... | ... |
@@ -1,19 +0,0 @@ |
1 |
-package MyDBI1; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'DBIx::Custom'; |
|
7 |
- |
|
8 |
-sub connect { |
|
9 |
- my $self = shift->SUPER::connect(@_); |
|
10 |
- |
|
11 |
- $self->include_model( |
|
12 |
- MyModel1 => [ |
|
13 |
- 'book', |
|
14 |
- {class => 'Company', name => 'company'} |
|
15 |
- ] |
|
16 |
- ); |
|
17 |
-} |
|
18 |
- |
|
19 |
-1; |
... | ... |
@@ -1,17 +0,0 @@ |
1 |
-package MyModel1::Company; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'DBIx::Custom::Model'; |
|
7 |
- |
|
8 |
- |
|
9 |
-sub insert { |
|
10 |
- my ($self, $param) = @_; |
|
11 |
- |
|
12 |
- return $self->SUPER::insert(param => $param); |
|
13 |
-} |
|
14 |
- |
|
15 |
-sub list { shift->select; } |
|
16 |
- |
|
17 |
-1; |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-package MyModel1::book; |
|
2 |
- |
|
3 |
-use DBIx::Custom::Model -base; |
|
4 |
- |
|
5 |
-sub insert { |
|
6 |
- my ($self, $param) = @_; |
|
7 |
- |
|
8 |
- return $self->SUPER::insert(param => $param); |
|
9 |
-} |
|
10 |
- |
|
11 |
-sub list { shift->select; } |
|
12 |
- |
|
13 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel4; |
|
2 |
- |
|
3 |
-use base 'DBIx::Custom::Model'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,9 +0,0 @@ |
1 |
-package MyModel4::book; |
|
2 |
- |
|
3 |
-use base 'MyModel4'; |
|
4 |
- |
|
5 |
-sub table { 'table1' } |
|
6 |
- |
|
7 |
-sub list { shift->select } |
|
8 |
- |
|
9 |
-1; |
... | ... |
@@ -1,8 +0,0 @@ |
1 |
-package MyModel4::company; |
|
2 |
- |
|
3 |
-use base 'MyModel4'; |
|
4 |
- |
|
5 |
-sub insert { shift->SUPER::insert(param => $_[0]) } |
|
6 |
-sub list { shift->select } |
|
7 |
- |
|
8 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel5; |
|
2 |
- |
|
3 |
-use base 'DBIx::Custom::Model'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,7 +0,0 @@ |
1 |
-package MyModel5::table1; |
|
2 |
- |
|
3 |
-use MyModel5 -base; |
|
4 |
- |
|
5 |
-has primary_key => sub { ['key1', 'key2'] }; |
|
6 |
- |
|
7 |
-1; |
... | ... |
@@ -1,12 +0,0 @@ |
1 |
-package MyModel5::table1_1; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'MyModel5'; |
|
7 |
- |
|
8 |
-__PACKAGE__->attr(table => 'table2'); |
|
9 |
- |
|
10 |
-__PACKAGE__->attr('primary_key' => sub { ['key1', 'key2'] }); |
|
11 |
- |
|
12 |
-1; |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-package MyModel5::table1_2; |
|
2 |
- |
|
3 |
-use strict; |
|
4 |
-use warnings; |
|
5 |
- |
|
6 |
-use base 'MyModel5'; |
|
7 |
- |
|
8 |
-__PACKAGE__->attr(name => 'table1_3'); |
|
9 |
-__PACKAGE__->attr(table => 'table3'); |
|
10 |
- |
|
11 |
-__PACKAGE__->attr('primary_key' => sub { ['key1', 'key2'] }); |
|
12 |
- |
|
13 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel6; |
|
2 |
- |
|
3 |
-use base 'DBIx::Custom::Model'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,14 +0,0 @@ |
1 |
-package MyModel6::table1; |
|
2 |
- |
|
3 |
-use base 'MyModel6'; |
|
4 |
- |
|
5 |
-__PACKAGE__->attr( |
|
6 |
- join => sub { |
|
7 |
- [ |
|
8 |
- 'left outer join table2 on table1.key1 = table2.key1' |
|
9 |
- ] |
|
10 |
- }, |
|
11 |
- primary_key => sub { ['key1'] } |
|
12 |
-); |
|
13 |
- |
|
14 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel6::table2; |
|
2 |
- |
|
3 |
-use base 'MyModel6'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,11 +0,0 @@ |
1 |
-package MyModel6::table3; |
|
2 |
- |
|
3 |
-use base 'MyModel6'; |
|
4 |
- |
|
5 |
-__PACKAGE__->attr(filter => sub { |
|
6 |
- [ |
|
7 |
- key1 => {in => sub { uc $_[0] }} |
|
8 |
- ] |
|
9 |
-}); |
|
10 |
- |
|
11 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel7; |
|
2 |
- |
|
3 |
-use base 'DBIx::Custom::Model'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,14 +0,0 @@ |
1 |
-package MyModel7::table1; |
|
2 |
- |
|
3 |
-use base 'MyModel7'; |
|
4 |
- |
|
5 |
-__PACKAGE__->attr( |
|
6 |
- primary_key => sub { ['key1'] }, |
|
7 |
- join => sub { |
|
8 |
- [ |
|
9 |
- 'left outer join table2 on table1.key1 = table2.key1' |
|
10 |
- ] |
|
11 |
- }, |
|
12 |
-); |
|
13 |
- |
|
14 |
-1; |
... | ... |
@@ -1,5 +0,0 @@ |
1 |
-package MyModel7::table2; |
|
2 |
- |
|
3 |
-use base 'MyModel7'; |
|
4 |
- |
|
5 |
-1; |
... | ... |
@@ -1,4 +0,0 @@ |
1 |
-package MyModel8; |
|
2 |
-use DBIx::Custom::Model -base; |
|
3 |
- |
|
4 |
-1; |
... | ... |
@@ -1,7 +0,0 @@ |
1 |
-package MyModel8::table1; |
|
2 |
-use MyModel8 -base; |
|
3 |
- |
|
4 |
-has join => sub { ['left join table2 as table2_alias on table1.key1 = table2_alias.key1'] }; |
|
5 |
- |
|
6 |
- |
|
7 |
-1; |
... | ... |
@@ -1,10 +0,0 @@ |
1 |
-package MyModel8::table2; |
|
2 |
-use MyModel8 -base; |
|
3 |
- |
|
4 |
-has filter => sub { |
|
5 |
- { |
|
6 |
- key3 => {out => sub { $_[0] * 2}, in => sub { $_[0] * 3}, end => sub { $_[0] * 4 }} |
|
7 |
- } |
|
8 |
-}; |
|
9 |
- |
|
10 |
-1; |