... | ... |
@@ -245,33 +245,6 @@ require MyDBI1; |
245 | 245 |
} |
246 | 246 |
} |
247 | 247 |
|
248 |
-test 'DBIx::Custom::Pool'; |
|
249 |
-use DBIx::Custom::Pool; |
|
250 |
-$dbi = DBIx::Custom->connect; |
|
251 |
-eval { $dbi->execute("drop table $table1") }; |
|
252 |
-$dbi->execute($create_table1); |
|
253 |
-$pool = DBIx::Custom::Pool->new; |
|
254 |
-$pool->count(3); |
|
255 |
-$pool->prepare(sub { |
|
256 |
- DBIx::Custom->connect; |
|
257 |
-}); |
|
258 |
-$dbi1 = $pool->get; |
|
259 |
-ok($dbi1); |
|
260 |
-$dbi2 = $pool->get; |
|
261 |
-ok($dbi1); |
|
262 |
-$dbi3 = $pool->get; |
|
263 |
-ok($dbi1); |
|
264 |
-eval {$pool->get}; |
|
265 |
-like($@, qr/empty/); |
|
266 |
-$pool->back($dbi1); |
|
267 |
-undef $dbi1; |
|
268 |
-$dbi1 = $pool->get; |
|
269 |
-ok($dbi1); |
|
270 |
-$pool->back($dbi1); |
|
271 |
-eval { $pool->back($dbi1) }; |
|
272 |
-like($@, qr/already/); |
|
273 |
- |
|
274 |
- |
|
275 | 248 |
test 'execute reuse option'; |
276 | 249 |
eval { $dbi->execute("drop table $table1") }; |
277 | 250 |
$dbi->execute($create_table1); |
... | ... |
@@ -32,12 +32,16 @@ my $rows; |
32 | 32 |
my $result; |
33 | 33 |
my $result2; |
34 | 34 |
my $model; |
35 |
+my $dbi1; |
|
35 | 36 |
my $dbi2; |
37 |
+my $dbi3; |
|
38 |
+my @dbis; |
|
39 |
+my @results; |
|
36 | 40 |
|
37 | 41 |
test 'connect'; |
38 | 42 |
eval { |
39 | 43 |
$dbi = DBIx::Custom->connect( |
40 |
- dsn => "dbi:mysql:database=$database;host=localhost;port=10000", |
|
44 |
+ dsn => "dbi:mysql:database=$database;", |
|
41 | 45 |
user => $user, |
42 | 46 |
password => $password |
43 | 47 |
); |
... | ... |
@@ -50,8 +54,7 @@ $dbi->insert({key1 => 1, key2 => 2}, table => 'table1'); |
50 | 54 |
|
51 | 55 |
test 'async test'; |
52 | 56 |
|
53 |
-use AnyEvent; |
|
54 |
-use DBI; |
|
57 |
+require AnyEvent; |
|
55 | 58 |
my $cond = AnyEvent->condvar; |
56 | 59 |
$result = $dbi->execute('SELECT SLEEP(1), 3', undef, |
57 | 60 |
prepare_attr => {async => 1}, statement => 'select'); |