... | ... |
@@ -24,131 +24,6 @@ use DBIx::Custom; |
24 | 24 |
package DBIx::Custom; |
25 | 25 |
has dsn => sub { 'dbi:SQLite:dbname=:memory:' } |
26 | 26 |
} |
27 |
-use MyDBI1; |
|
28 |
-{ |
|
29 |
- package MyDBI4; |
|
30 |
- |
|
31 |
- use strict; |
|
32 |
- use warnings; |
|
33 |
- |
|
34 |
- use base 'DBIx::Custom'; |
|
35 |
- |
|
36 |
- sub connect { |
|
37 |
- my $self = shift->SUPER::connect(@_); |
|
38 |
- |
|
39 |
- $self->include_model( |
|
40 |
- MyModel2 => [ |
|
41 |
- 'table1', |
|
42 |
- {class => 'table2', name => 'table2'} |
|
43 |
- ] |
|
44 |
- ); |
|
45 |
- } |
|
46 |
- |
|
47 |
- package MyModel2::Base1; |
|
48 |
- |
|
49 |
- use strict; |
|
50 |
- use warnings; |
|
51 |
- |
|
52 |
- use base 'DBIx::Custom::Model'; |
|
53 |
- |
|
54 |
- package MyModel2::table1; |
|
55 |
- |
|
56 |
- use strict; |
|
57 |
- use warnings; |
|
58 |
- |
|
59 |
- use base 'MyModel2::Base1'; |
|
60 |
- |
|
61 |
- sub insert { |
|
62 |
- my ($self, $param) = @_; |
|
63 |
- |
|
64 |
- return $self->SUPER::insert(param => $param); |
|
65 |
- } |
|
66 |
- |
|
67 |
- sub list { shift->select; } |
|
68 |
- |
|
69 |
- package MyModel2::table2; |
|
70 |
- |
|
71 |
- use strict; |
|
72 |
- use warnings; |
|
73 |
- |
|
74 |
- use base 'MyModel2::Base1'; |
|
75 |
- |
|
76 |
- sub insert { |
|
77 |
- my ($self, $param) = @_; |
|
78 |
- |
|
79 |
- return $self->SUPER::insert(param => $param); |
|
80 |
- } |
|
81 |
- |
|
82 |
- sub list { shift->select; } |
|
83 |
-} |
|
84 |
-{ |
|
85 |
- package MyDBI5; |
|
86 |
- |
|
87 |
- use strict; |
|
88 |
- use warnings; |
|
89 |
- |
|
90 |
- use base 'DBIx::Custom'; |
|
91 |
- |
|
92 |
- sub connect { |
|
93 |
- my $self = shift->SUPER::connect(@_); |
|
94 |
- |
|
95 |
- $self->include_model('MyModel4'); |
|
96 |
- } |
|
97 |
-} |
|
98 |
-{ |
|
99 |
- package MyDBI6; |
|
100 |
- |
|
101 |
- use base 'DBIx::Custom'; |
|
102 |
- |
|
103 |
- sub connect { |
|
104 |
- my $self = shift->SUPER::connect(@_); |
|
105 |
- |
|
106 |
- $self->include_model('MyModel5'); |
|
107 |
- |
|
108 |
- return $self; |
|
109 |
- } |
|
110 |
-} |
|
111 |
-{ |
|
112 |
- package MyDBI7; |
|
113 |
- |
|
114 |
- use base 'DBIx::Custom'; |
|
115 |
- |
|
116 |
- sub connect { |
|
117 |
- my $self = shift->SUPER::connect(@_); |
|
118 |
- |
|
119 |
- $self->include_model('MyModel6'); |
|
120 |
- |
|
121 |
- |
|
122 |
- return $self; |
|
123 |
- } |
|
124 |
-} |
|
125 |
-{ |
|
126 |
- package MyDBI8; |
|
127 |
- |
|
128 |
- use base 'DBIx::Custom'; |
|
129 |
- |
|
130 |
- sub connect { |
|
131 |
- my $self = shift->SUPER::connect(@_); |
|
132 |
- |
|
133 |
- $self->include_model('MyModel7'); |
|
134 |
- |
|
135 |
- return $self; |
|
136 |
- } |
|
137 |
-} |
|
138 |
- |
|
139 |
-{ |
|
140 |
- package MyDBI9; |
|
141 |
- |
|
142 |
- use base 'DBIx::Custom'; |
|
143 |
- |
|
144 |
- sub connect { |
|
145 |
- my $self = shift->SUPER::connect(@_); |
|
146 |
- |
|
147 |
- $self->include_model('MyModel8')->setup_model; |
|
148 |
- |
|
149 |
- return $self; |
|
150 |
- } |
|
151 |
-} |
|
152 | 27 |
|
153 | 28 |
# Constant |
154 | 29 |
my $create_table1 = 'create table table1 (key1 varchar, key2 varchar);'; |