Showing 1 changed files with 138 additions and 147 deletions
+138 -147
t/basic.t
... ...
@@ -4,7 +4,6 @@ use warnings;
4 4
 
5 5
 use utf8;
6 6
 use Encode qw/encode_utf8 decode_utf8/;
7
-use Data::Dumper;
8 7
 
9 8
 $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /DEPRECATED/};
10 9
 
... ...
@@ -37,14 +36,6 @@ my $SELECT_SOURCES = {
37 36
     0 => 'select * from table1;'
38 37
 };
39 38
 
40
-my $DROP_TABLE = {
41
-    0 => 'drop table table1'
42
-};
43
-
44
-my $NEW_ARGS = {
45
-    0 => {dsn => 'dbi:SQLite:dbname=:memory:'}
46
-};
47
-
48 39
 # Variables
49 40
 my $dbi;
50 41
 my $sth;
... ...
@@ -75,7 +66,7 @@ my $insert_param;
75 66
 my $join;
76 67
 
77 68
 # Prepare table
78
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
69
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
79 70
 $dbi->execute($CREATE_TABLE->{0});
80 71
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
81 72
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -107,7 +98,7 @@ $rows = $result->fetch_hash_all;
107 98
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "all");
108 99
 
109 100
 test 'Insert query return value';
110
-$dbi->execute($DROP_TABLE->{0});
101
+$dbi->execute('drop table table1');
111 102
 $dbi->execute($CREATE_TABLE->{0});
112 103
 $source = "insert into table1 {insert_param key1 key2}";
113 104
 $query = $dbi->execute($source, {}, query => 1);
... ...
@@ -116,7 +107,7 @@ ok($ret_val);
116 107
 
117 108
 
118 109
 test 'Direct query';
119
-$dbi->execute($DROP_TABLE->{0});
110
+$dbi->execute('drop table table1');
120 111
 $dbi->execute($CREATE_TABLE->{0});
121 112
 $insert_SOURCE = "insert into table1 {insert_param key1 key2}";
122 113
 $dbi->execute($insert_SOURCE, param => {key1 => 1, key2 => 2});
... ...
@@ -125,7 +116,7 @@ $rows = $result->all;
125 116
 is_deeply($rows, [{key1 => 1, key2 => 2}]);
126 117
 
127 118
 test 'Filter basic';
128
-$dbi->execute($DROP_TABLE->{0});
119
+$dbi->execute('drop table table1');
129 120
 $dbi->execute($CREATE_TABLE->{0});
130 121
 $dbi->register_filter(twice       => sub { $_[0] * 2}, 
131 122
                     three_times => sub { $_[0] * 3});
... ...
@@ -137,7 +128,7 @@ $dbi->execute($insert_query, param => {key1 => 1, key2 => 2});
137 128
 $result = $dbi->execute($SELECT_SOURCES->{0});
138 129
 $rows = $result->filter({key2 => 'three_times'})->all;
139 130
 is_deeply($rows, [{key1 => 2, key2 => 6}], "filter fetch_filter");
140
-$dbi->execute($DROP_TABLE->{0});
131
+$dbi->execute('drop table table1');
141 132
 
142 133
 test 'Filter in';
143 134
 $dbi->execute($CREATE_TABLE->{0});
... ...
@@ -152,7 +143,7 @@ $rows = $result->all;
152 143
 is_deeply($rows, [{key1 => 2, key2 => 4}], "filter");
153 144
 
154 145
 test 'DBIx::Custom::SQLTemplate basic tag';
155
-$dbi->execute($DROP_TABLE->{0});
146
+$dbi->execute('drop table table1');
156 147
 $dbi->execute($CREATE_TABLE->{1});
157 148
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
158 149
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -176,7 +167,7 @@ $rows = $result->all;
176 167
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "basic tag2");
177 168
 
178 169
 test 'DIB::Custom::SQLTemplate in tag';
179
-$dbi->execute($DROP_TABLE->{0});
170
+$dbi->execute('drop table table1');
180 171
 $dbi->execute($CREATE_TABLE->{1});
181 172
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
182 173
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -212,7 +203,7 @@ is_deeply($rows, [{key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5},
212 203
 
213 204
 
214 205
 test 'Named placeholder';
215
-$dbi->execute($DROP_TABLE->{0});
206
+$dbi->execute('drop table table1');
216 207
 $dbi->execute($CREATE_TABLE->{1});
217 208
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
218 209
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -241,7 +232,7 @@ $result = $dbi->execute(
241 232
 $rows = $result->all;
242 233
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}]);
243 234
 
244
-$dbi->execute($DROP_TABLE->{0});
235
+$dbi->execute('drop table table1');
245 236
 $dbi->execute($CREATE_TABLE->{0});
246 237
 $dbi->insert(table => 'table1', param => {key1 => '2011-10-14 12:19:18', key2 => 2});
247 238
 $source = "select * from table1 where key1 = '2011-10-14 12:19:18' and key2 = :key2";
... ...
@@ -253,7 +244,7 @@ $result = $dbi->execute(
253 244
 $rows = $result->all;
254 245
 is_deeply($rows, [{key1 => '2011-10-14 12:19:18', key2 => 2}]);
255 246
 
256
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
247
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
257 248
 $dbi->execute($CREATE_TABLE->{0});
258 249
 $dbi->insert(table => 'table1', param => {key1 => 'a:b c:d', key2 => 2});
259 250
 $source = "select * from table1 where key1 = 'a\\:b c\\:d' and key2 = :key2";
... ...
@@ -269,12 +260,12 @@ test 'Error case';
269 260
 eval {DBIx::Custom->connect(dsn => 'dbi:SQLit')};
270 261
 ok($@, "connect error");
271 262
 
272
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
263
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
273 264
 eval{$dbi->execute("{p }", {}, query => 1)};
274 265
 ok($@, "create_query invalid SQL template");
275 266
 
276 267
 test 'insert';
277
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
268
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
278 269
 $dbi->execute($CREATE_TABLE->{0});
279 270
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
280 271
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -294,7 +285,7 @@ $rows   = $result->all;
294 285
 is_deeply($rows, [{key1 => 3, key2 => 4}], "filter");
295 286
 $dbi->default_bind_filter(undef);
296 287
 
297
-$dbi->execute($DROP_TABLE->{0});
288
+$dbi->execute('drop table table1');
298 289
 $dbi->execute($CREATE_TABLE->{0});
299 290
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2}, append => '   ');
300 291
 $rows = $dbi->select(table => 'table1')->all;
... ...
@@ -306,7 +297,7 @@ like($@, qr/noexist/, "invalid");
306 297
 eval{$dbi->insert(table => 'table', param => {';' => 1})};
307 298
 like($@, qr/safety/);
308 299
 
309
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
300
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
310 301
 $dbi->quote('"');
311 302
 $dbi->execute('create table "table" ("select")');
312 303
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
... ...
@@ -315,7 +306,7 @@ $result = $dbi->execute('select * from "table"');
315 306
 $rows   = $result->all;
316 307
 is_deeply($rows, [{select => 2}], "reserved word");
317 308
 
318
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
309
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
319 310
 $dbi->execute($CREATE_TABLE->{0});
320 311
 $dbi->insert({key1 => 1, key2 => 2}, table => 'table1');
321 312
 $dbi->insert({key1 => 3, key2 => 4}, table => 'table1');
... ...
@@ -323,7 +314,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
323 314
 $rows   = $result->all;
324 315
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "basic");
325 316
 
326
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
317
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
327 318
 $dbi->execute("create table table1 (key1 char(255), key2 char(255), primary key(key1))");
328 319
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
329 320
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 4}, prefix => 'or replace');
... ...
@@ -331,7 +322,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
331 322
 $rows   = $result->all;
332 323
 is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
333 324
 
334
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
325
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
335 326
 $dbi->execute($CREATE_TABLE->{0});
336 327
 $dbi->insert(table => 'table1', param => {key1 => \"'1'", key2 => 2});
337 328
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -340,7 +331,7 @@ $rows   = $result->all;
340 331
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "basic");
341 332
 
342 333
 test 'update';
343
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
334
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
344 335
 $dbi->execute($CREATE_TABLE->{1});
345 336
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
346 337
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -388,7 +379,7 @@ like($@, qr/noexist/, "invalid");
388 379
 eval{$dbi->update(table => 'table1')};
389 380
 like($@, qr/where/, "not contain where");
390 381
 
391
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
382
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
392 383
 $dbi->execute($CREATE_TABLE->{0});
393 384
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
394 385
 $where = $dbi->where;
... ...
@@ -398,7 +389,7 @@ $dbi->update(table => 'table1', param => {key1 => 3}, where => $where);
398 389
 $result = $dbi->select(table => 'table1');
399 390
 is_deeply($result->all, [{key1 => 3, key2 => 2}], 'update() where');
400 391
 
401
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
392
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
402 393
 $dbi->execute($CREATE_TABLE->{0});
403 394
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
404 395
 $dbi->update(
... ...
@@ -412,7 +403,7 @@ $dbi->update(
412 403
 $result = $dbi->select(table => 'table1');
413 404
 is_deeply($result->all, [{key1 => 3, key2 => 2}], 'update() where');
414 405
 
415
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
406
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
416 407
 $dbi->execute($CREATE_TABLE->{0});
417 408
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
418 409
 $where = $dbi->where;
... ...
@@ -428,7 +419,7 @@ like($@, qr/safety/);
428 419
 eval{$dbi->update(table => 'table1', param => {'key1' => 1}, where => {';' => 1})};
429 420
 like($@, qr/safety/);
430 421
 
431
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
422
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
432 423
 $dbi->quote('"');
433 424
 $dbi->execute('create table "table" ("select", "update")');
434 425
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
... ...
@@ -442,7 +433,7 @@ is_deeply($rows, [{select => 2, update => 6}], "reserved word");
442 433
 eval {$dbi->update_all(table => 'table', param => {';' => 2}) };
443 434
 like($@, qr/safety/);
444 435
 
445
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
436
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
446 437
 $dbi->reserved_word_quote('"');
447 438
 $dbi->execute('create table "table" ("select", "update")');
448 439
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
... ...
@@ -453,7 +444,7 @@ $result = $dbi->execute('select * from "table"');
453 444
 $rows   = $result->all;
454 445
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
455 446
 
456
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
447
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
457 448
 $dbi->execute($CREATE_TABLE->{1});
458 449
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
459 450
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -464,7 +455,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
464 455
                   {key1 => 6, key2 => 7,  key3 => 8, key4 => 9, key5 => 10}],
465 456
                   "basic");
466 457
 
467
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
458
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
468 459
 $dbi->execute("create table table1 (key1 char(255), key2 char(255), primary key(key1))");
469 460
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
470 461
 $dbi->update(table => 'table1', param => {key2 => 4},
... ...
@@ -473,7 +464,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
473 464
 $rows   = $result->all;
474 465
 is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
475 466
 
476
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
467
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
477 468
 $dbi->execute($CREATE_TABLE->{1});
478 469
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
479 470
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -485,7 +476,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
485 476
                   "basic");
486 477
 
487 478
 test 'update_all';
488
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
479
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
489 480
 $dbi->execute($CREATE_TABLE->{1});
490 481
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
491 482
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -499,7 +490,7 @@ is_deeply($rows, [{key1 => 1, key2 => 20, key3 => 3, key4 => 4, key5 => 5},
499 490
 
500 491
 
501 492
 test 'delete';
502
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
493
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
503 494
 $dbi->execute($CREATE_TABLE->{0});
504 495
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
505 496
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -529,7 +520,7 @@ is_deeply($rows, [{key1 => 3, key2 => 4}], "delete multi key");
529 520
 eval{$dbi->delete(table => 'table1', where => {key1 => 1}, noexist => 1)};
530 521
 like($@, qr/noexist/, "invalid");
531 522
 
532
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
523
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
533 524
 $dbi->execute($CREATE_TABLE->{0});
534 525
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
535 526
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -540,7 +531,7 @@ $dbi->delete(table => 'table1', where => $where);
540 531
 $result = $dbi->select(table => 'table1');
541 532
 is_deeply($result->all, [{key1 => 3, key2 => 4}], 'delete() where');
542 533
 
543
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
534
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
544 535
 $dbi->execute($CREATE_TABLE->{0});
545 536
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
546 537
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -554,7 +545,7 @@ $dbi->delete(
554 545
 $result = $dbi->select(table => 'table1');
555 546
 is_deeply($result->all, [{key1 => 3, key2 => 4}], 'delete() where');
556 547
 
557
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
548
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
558 549
 $dbi->execute("create table table1 (key1 char(255), key2 char(255), primary key(key1))");
559 550
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
560 551
 $dbi->delete(table => 'table1', where => {key1 => 1}, prefix => '    ');
... ...
@@ -563,7 +554,7 @@ $rows   = $result->all;
563 554
 is_deeply($rows, [], "basic");
564 555
 
565 556
 test 'delete error';
566
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
557
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
567 558
 $dbi->execute($CREATE_TABLE->{0});
568 559
 eval{$dbi->delete(table => 'table1')};
569 560
 like($@, qr/"where" must be specified/,
... ...
@@ -572,7 +563,7 @@ like($@, qr/"where" must be specified/,
572 563
 eval{$dbi->delete(table => 'table1', where => {';' => 1})};
573 564
 like($@, qr/safety/);
574 565
 
575
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
566
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
576 567
 $dbi->quote('"');
577 568
 $dbi->execute('create table "table" ("select", "update")');
578 569
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
... ...
@@ -583,7 +574,7 @@ $rows   = $result->all;
583 574
 is_deeply($rows, [], "reserved word");
584 575
 
585 576
 test 'delete_all';
586
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
577
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
587 578
 $dbi->execute($CREATE_TABLE->{0});
588 579
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
589 580
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -594,7 +585,7 @@ is_deeply($rows, [], "basic");
594 585
 
595 586
 
596 587
 test 'select';
597
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
588
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
598 589
 $dbi->execute($CREATE_TABLE->{0});
599 590
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
600 591
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -639,7 +630,7 @@ is_deeply($rows, [{table1_key1 => 1, table2_key1 => 1, key2 => 2, key3 => 5}], "
639 630
 eval{$dbi->select(table => 'table1', noexist => 1)};
640 631
 like($@, qr/noexist/, "invalid");
641 632
 
642
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
633
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
643 634
 $dbi->quote('"');
644 635
 $dbi->execute('create table "table" ("select", "update")');
645 636
 $dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
... ...
@@ -649,7 +640,7 @@ $rows   = $result->all;
649 640
 is_deeply($rows, [{select => 2, update => 2}], "reserved word");
650 641
 
651 642
 test 'fetch filter';
652
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
643
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
653 644
 $dbi->register_filter(
654 645
     twice       => sub { $_[0] * 2 },
655 646
     three_times => sub { $_[0] * 3 }
... ...
@@ -672,7 +663,7 @@ is($dbi->filters->{encode_utf8}->('あ'),
672 663
    encode_utf8('あ'), "encode_utf8");
673 664
 
674 665
 test 'transaction';
675
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
666
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
676 667
 $dbi->execute($CREATE_TABLE->{0});
677 668
 $dbi->dbh->begin_work;
678 669
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -682,7 +673,7 @@ $result = $dbi->select(table => 'table1');
682 673
 is_deeply(scalar $result->all, [{key1 => 1, key2 => 2}, {key1 => 2, key2 => 3}],
683 674
           "commit");
684 675
 
685
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
676
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
686 677
 $dbi->execute($CREATE_TABLE->{0});
687 678
 $dbi->dbh->begin_work(0);
688 679
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -692,7 +683,7 @@ $result = $dbi->select(table => 'table1');
692 683
 ok(! $result->fetch_first, "rollback");
693 684
 
694 685
 test 'cache';
695
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
686
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
696 687
 $dbi->cache(1);
697 688
 $dbi->execute($CREATE_TABLE->{0});
698 689
 $source = 'select * from table1 where key1 = :key1 and key2 = :key2;';
... ...
@@ -700,7 +691,7 @@ $dbi->execute($source, {}, query => 1);
700 691
 is_deeply($dbi->{_cached}->{$source}, 
701 692
           {sql => "select * from table1 where key1 = ? and key2 = ?;", columns => ['key1', 'key2'], tables => []}, "cache");
702 693
 
703
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
694
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
704 695
 $dbi->execute($CREATE_TABLE->{0});
705 696
 $dbi->{_cached} = {};
706 697
 $dbi->cache(0);
... ...
@@ -708,7 +699,7 @@ $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
708 699
 is(scalar keys %{$dbi->{_cached}}, 0, 'not cache');
709 700
 
710 701
 test 'execute';
711
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
702
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
712 703
 $dbi->execute($CREATE_TABLE->{0});
713 704
 {
714 705
     local $Carp::Verbose = 0;
... ...
@@ -743,7 +734,7 @@ ok($@, "execute fail");
743 734
 
744 735
 
745 736
 test 'transaction';
746
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
737
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
747 738
 $dbi->execute($CREATE_TABLE->{0});
748 739
 
749 740
 $dbi->begin_work;
... ...
@@ -780,7 +771,7 @@ $dbi->dbh->{AutoCommit} = 1;
780 771
 
781 772
 
782 773
 test 'method';
783
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
774
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
784 775
 $dbi->method(
785 776
     one => sub { 1 }
786 777
 );
... ...
@@ -802,7 +793,7 @@ eval {$dbi->XXXXXX};
802 793
 ok($@, "not exists");
803 794
 
804 795
 test 'out filter';
805
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
796
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
806 797
 $dbi->execute($CREATE_TABLE->{0});
807 798
 $dbi->register_filter(twice => sub { $_[0] * 2 });
808 799
 $dbi->register_filter(three_times => sub { $_[0] * 3});
... ...
@@ -817,7 +808,7 @@ $result = $dbi->select(table => 'table1');
817 808
 $row   = $result->one;
818 809
 is_deeply($row, {key1 => 6, key2 => 12}, "insert");
819 810
 
820
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
811
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
821 812
 $dbi->execute($CREATE_TABLE->{0});
822 813
 $dbi->register_filter(twice => sub { $_[0] * 2 });
823 814
 $dbi->register_filter(three_times => sub { $_[0] * 3});
... ...
@@ -832,7 +823,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
832 823
 $row   = $result->one;
833 824
 is_deeply($row, {key1 => 1, key2 => 6}, "insert");
834 825
 
835
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
826
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
836 827
 $dbi->execute($CREATE_TABLE->{0});
837 828
 $dbi->register_filter(twice => sub { $_[0] * 2 });
838 829
 $dbi->apply_filter(
... ...
@@ -844,7 +835,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
844 835
 $row   = $result->one;
845 836
 is_deeply($row, {key1 => 4, key2 => 2}, "update");
846 837
 
847
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
838
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
848 839
 $dbi->execute($CREATE_TABLE->{0});
849 840
 $dbi->register_filter(twice => sub { $_[0] * 2 });
850 841
 $dbi->apply_filter(
... ...
@@ -856,7 +847,7 @@ $result = $dbi->execute($SELECT_SOURCES->{0});
856 847
 $rows   = $result->all;
857 848
 is_deeply($rows, [], "delete");
858 849
 
859
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
850
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
860 851
 $dbi->execute($CREATE_TABLE->{0});
861 852
 $dbi->register_filter(twice => sub { $_[0] * 2 });
862 853
 $dbi->apply_filter(
... ...
@@ -868,7 +859,7 @@ $result->filter({'key2' => 'twice'});
868 859
 $rows   = $result->all;
869 860
 is_deeply($rows, [{key1 => 4, key2 => 4}], "select");
870 861
 
871
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
862
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
872 863
 $dbi->execute($CREATE_TABLE->{0});
873 864
 $dbi->register_filter(twice => sub { $_[0] * 2 });
874 865
 $dbi->apply_filter(
... ...
@@ -881,7 +872,7 @@ $result = $dbi->execute("select * from table1 where key1 = :key1 and key2 = :key
881 872
 $rows   = $result->all;
882 873
 is_deeply($rows, [{key1 => 4, key2 => 2}], "execute");
883 874
 
884
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
875
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
885 876
 $dbi->execute($CREATE_TABLE->{0});
886 877
 $dbi->register_filter(twice => sub { $_[0] * 2 });
887 878
 $dbi->apply_filter(
... ...
@@ -893,7 +884,7 @@ $result = $dbi->execute("select * from {table table1} where key1 = :key1 and key
893 884
 $rows   = $result->all;
894 885
 is_deeply($rows, [{key1 => 4, key2 => 2}], "execute table tag");
895 886
 
896
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
887
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
897 888
 $dbi->execute($CREATE_TABLE->{0});
898 889
 $dbi->execute($CREATE_TABLE->{2});
899 890
 $dbi->register_filter(twice => sub { $_[0] * 2 });
... ...
@@ -925,7 +916,7 @@ $rows   = $result->all;
925 916
 is_deeply($rows, [{key2 => 4, key3 => 18}], "select : join : omit");
926 917
 
927 918
 test 'each_column';
928
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
919
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
929 920
 $dbi->execute($CREATE_TABLE->{2});
930 921
 $dbi->execute($CREATE_TABLE->{3});
931 922
 
... ...
@@ -949,7 +940,7 @@ is_deeply($infos,
949 940
     
950 941
 );
951 942
 test 'each_table';
952
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
943
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
953 944
 $dbi->execute($CREATE_TABLE->{2});
954 945
 $dbi->execute($CREATE_TABLE->{3});
955 946
 
... ...
@@ -971,7 +962,7 @@ is_deeply($infos,
971 962
 );
972 963
 
973 964
 test 'limit';
974
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
965
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
975 966
 $dbi->execute($CREATE_TABLE->{0});
976 967
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
977 968
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 4});
... ...
@@ -1024,12 +1015,12 @@ test 'connect super';
1024 1015
     }
1025 1016
 }
1026 1017
 
1027
-$dbi = MyDBI->connect($NEW_ARGS->{0});
1018
+$dbi = MyDBI->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1028 1019
 $dbi->execute($CREATE_TABLE->{0});
1029 1020
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1030 1021
 is($dbi->select(table => 'table1')->one->{key1}, 1);
1031 1022
 
1032
-$dbi = MyDBI->new($NEW_ARGS->{0});
1023
+$dbi = MyDBI->new(dsn => 'dbi:SQLite:dbname=:memory:');
1033 1024
 $dbi->connect;
1034 1025
 $dbi->execute($CREATE_TABLE->{0});
1035 1026
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -1047,13 +1038,13 @@ is($dbi->select(table => 'table1')->one->{key1}, 1);
1047 1038
     }
1048 1039
 }
1049 1040
 
1050
-$dbi = MyDBI->connect($NEW_ARGS->{0});
1041
+$dbi = MyDBI->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1051 1042
 $dbi->execute($CREATE_TABLE->{0});
1052 1043
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1053 1044
 is($dbi->select(table => 'table1')->one->{key1}, 1);
1054 1045
 
1055 1046
 test 'end_filter';
1056
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1047
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1057 1048
 $dbi->execute($CREATE_TABLE->{0});
1058 1049
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1059 1050
 $result = $dbi->select(table => 'table1');
... ...
@@ -1062,7 +1053,7 @@ $result->end_filter(key1 => sub { $_[0] * 3 }, key2 => sub { $_[0] * 5 });
1062 1053
 $row = $result->fetch_first;
1063 1054
 is_deeply($row, [6, 40]);
1064 1055
 
1065
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1056
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1066 1057
 $dbi->execute($CREATE_TABLE->{0});
1067 1058
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1068 1059
 $result = $dbi->select(table => 'table1');
... ...
@@ -1071,7 +1062,7 @@ $result->end_filter([[qw/key1 key2/] => sub { $_[0] * 3 }]);
1071 1062
 $row = $result->fetch_first;
1072 1063
 is_deeply($row, [6, 12]);
1073 1064
 
1074
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1065
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1075 1066
 $dbi->execute($CREATE_TABLE->{0});
1076 1067
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1077 1068
 $result = $dbi->select(table => 'table1');
... ...
@@ -1110,7 +1101,7 @@ $row = $result->one;
1110 1101
 is_deeply($row, {key1 => 1, key2 => 40}, 'apply_filter overwrite');
1111 1102
 
1112 1103
 test 'remove_end_filter and remove_filter';
1113
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1104
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1114 1105
 $dbi->execute($CREATE_TABLE->{0});
1115 1106
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1116 1107
 $result = $dbi->select(table => 'table1');
... ...
@@ -1123,7 +1114,7 @@ $row = $result
1123 1114
 is_deeply($row, [1, 2]);
1124 1115
 
1125 1116
 test 'empty where select';
1126
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1117
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1127 1118
 $dbi->execute($CREATE_TABLE->{0});
1128 1119
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1129 1120
 $result = $dbi->select(table => 'table1', where => {});
... ...
@@ -1131,7 +1122,7 @@ $row = $result->one;
1131 1122
 is_deeply($row, {key1 => 1, key2 => 2});
1132 1123
 
1133 1124
 test 'select query option';
1134
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1125
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1135 1126
 $dbi->execute($CREATE_TABLE->{0});
1136 1127
 $query = $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2}, query => 1);
1137 1128
 is(ref $query, 'DBIx::Custom::Query');
... ...
@@ -1143,7 +1134,7 @@ $query = $dbi->select(table => 'table1', where => {key1 => 1, key2 => 2}, query
1143 1134
 is(ref $query, 'DBIx::Custom::Query');
1144 1135
 
1145 1136
 test 'DBIx::Custom::Where';
1146
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1137
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1147 1138
 $dbi->execute($CREATE_TABLE->{0});
1148 1139
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1149 1140
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -1435,21 +1426,21 @@ $dbi = DBIx::Custom->new;
1435 1426
 is_deeply($dbi->dbi_option, {});
1436 1427
 
1437 1428
 test 'register_tag_processor';
1438
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1429
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1439 1430
 $dbi->register_tag_processor(
1440 1431
     a => sub { 1 }
1441 1432
 );
1442 1433
 is($dbi->query_builder->tag_processors->{a}->(), 1);
1443 1434
 
1444 1435
 test 'register_tag';
1445
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1436
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1446 1437
 $dbi->register_tag(
1447 1438
     b => sub { 2 }
1448 1439
 );
1449 1440
 is($dbi->query_builder->tags->{b}->(), 2);
1450 1441
 
1451 1442
 test 'table not specify exception';
1452
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1443
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1453 1444
 eval {$dbi->insert};
1454 1445
 like($@, qr/table/);
1455 1446
 eval {$dbi->update};
... ...
@@ -1461,7 +1452,7 @@ like($@, qr/table/);
1461 1452
 
1462 1453
 
1463 1454
 test 'more tests';
1464
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1455
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1465 1456
 eval{$dbi->apply_filter('table', 'column', [])};
1466 1457
 like($@, qr/apply_filter/);
1467 1458
 
... ...
@@ -1471,7 +1462,7 @@ like($@, qr/apply_filter/);
1471 1462
 $dbi->apply_filter(
1472 1463
 
1473 1464
 );
1474
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1465
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1475 1466
 $dbi->execute($CREATE_TABLE->{0});
1476 1467
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1477 1468
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -1480,7 +1471,7 @@ $dbi->apply_filter('table1', 'key2',
1480 1471
 $rows = $dbi->select(table => 'table1', where => {key2 => 1})->all;
1481 1472
 is_deeply($rows, [{key1 => 1, key2 => 6}]);
1482 1473
 
1483
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1474
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1484 1475
 $dbi->execute($CREATE_TABLE->{0});
1485 1476
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
1486 1477
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -1488,7 +1479,7 @@ $dbi->apply_filter('table1', 'key2', {});
1488 1479
 $rows = $dbi->select(table => 'table1', where => {key2 => 2})->all;
1489 1480
 is_deeply($rows, [{key1 => 1, key2 => 2}]);
1490 1481
 
1491
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1482
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1492 1483
 eval {$dbi->apply_filter('table1', 'key2', {out => 'no'})};
1493 1484
 like($@, qr/not registered/);
1494 1485
 eval {$dbi->apply_filter('table1', 'key2', {in => 'no'})};
... ...
@@ -1499,7 +1490,7 @@ is($dbi->one, 1);
1499 1490
 eval{DBIx::Custom->connect()};
1500 1491
 like($@, qr/_connect/);
1501 1492
 
1502
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1493
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1503 1494
 $dbi->execute($CREATE_TABLE->{0});
1504 1495
 $dbi->register_filter(twice => sub { $_[0] * 2 });
1505 1496
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2},
... ...
@@ -1526,7 +1517,7 @@ ok(!defined $dbi->default_fetch_filter);
1526 1517
 eval {$dbi->execute('select * from table1 {} {= author') };
1527 1518
 like($@, qr/Tag not finished/);
1528 1519
 
1529
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1520
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1530 1521
 $dbi->execute($CREATE_TABLE->{0});
1531 1522
 $dbi->register_filter(one => sub { 1 });
1532 1523
 $result = $dbi->select(table => 'table1');
... ...
@@ -1554,7 +1545,7 @@ $result->stash->{foo} = 1;
1554 1545
 is($result->stash->{foo}, 1, 'get and set');
1555 1546
 
1556 1547
 test 'filter __ expression';
1557
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1548
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1558 1549
 $dbi->execute('create table company (id, name, location_id)');
1559 1550
 $dbi->execute('create table location (id, name)');
1560 1551
 $dbi->apply_filter('location',
... ...
@@ -1584,7 +1575,7 @@ is($result->fetch_first->[0], 'B');
1584 1575
 
1585 1576
 test 'Model class';
1586 1577
 use MyDBI1;
1587
-$dbi = MyDBI1->connect($NEW_ARGS->{0});
1578
+$dbi = MyDBI1->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1588 1579
 $dbi->execute("create table book (title, author)");
1589 1580
 $model = $dbi->model('book');
1590 1581
 $model->insert({title => 'a', author => 'b'});
... ...
@@ -1652,7 +1643,7 @@ is($dbi->models->{'company'}, $dbi->model('company'));
1652 1643
 
1653 1644
     sub list { shift->select; }
1654 1645
 }
1655
-$dbi = MyDBI4->connect($NEW_ARGS->{0});
1646
+$dbi = MyDBI4->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1656 1647
 $dbi->execute("create table book (title, author)");
1657 1648
 $model = $dbi->model('book');
1658 1649
 $model->insert({title => 'a', author => 'b'});
... ...
@@ -1676,7 +1667,7 @@ is_deeply($model->list->all, [{name => 'a'}], 'basic');
1676 1667
         $self->include_model('MyModel4');
1677 1668
     }
1678 1669
 }
1679
-$dbi = MyDBI5->connect($NEW_ARGS->{0});
1670
+$dbi = MyDBI5->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1680 1671
 $dbi->execute("create table company (name)");
1681 1672
 $dbi->execute("create table table1 (key1)");
1682 1673
 $model = $dbi->model('company');
... ...
@@ -1688,21 +1679,21 @@ is_deeply($model->list->all, [{key1 => 1}], 'include all model');
1688 1679
 
1689 1680
 test 'primary_key';
1690 1681
 use MyDBI1;
1691
-$dbi = MyDBI1->connect($NEW_ARGS->{0});
1682
+$dbi = MyDBI1->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1692 1683
 $model = $dbi->model('book');
1693 1684
 $model->primary_key(['id', 'number']);
1694 1685
 is_deeply($model->primary_key, ['id', 'number']);
1695 1686
 
1696 1687
 test 'columns';
1697 1688
 use MyDBI1;
1698
-$dbi = MyDBI1->connect($NEW_ARGS->{0});
1689
+$dbi = MyDBI1->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1699 1690
 $model = $dbi->model('book');
1700 1691
 $model->columns(['id', 'number']);
1701 1692
 is_deeply($model->columns, ['id', 'number']);
1702 1693
 
1703 1694
 test 'setup_model';
1704 1695
 use MyDBI1;
1705
-$dbi = MyDBI1->connect($NEW_ARGS->{0});
1696
+$dbi = MyDBI1->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1706 1697
 $dbi->execute('create table book (id)');
1707 1698
 $dbi->execute('create table company (id, name);');
1708 1699
 $dbi->execute('create table test (id, name, primary key (id, name));');
... ...
@@ -1711,7 +1702,7 @@ is_deeply($dbi->model('book')->columns, ['id']);
1711 1702
 is_deeply($dbi->model('company')->columns, ['id', 'name']);
1712 1703
 
1713 1704
 test 'delete_at';
1714
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1705
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1715 1706
 $dbi->execute($CREATE_TABLE->{1});
1716 1707
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1717 1708
 $dbi->delete_at(
... ...
@@ -1730,7 +1721,7 @@ $dbi->delete_at(
1730 1721
 is_deeply($dbi->select(table => 'table1')->all, []);
1731 1722
 
1732 1723
 test 'insert_at';
1733
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1724
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1734 1725
 $dbi->execute($CREATE_TABLE->{1});
1735 1726
 $dbi->insert_at(
1736 1727
     primary_key => ['key1', 'key2'], 
... ...
@@ -1765,7 +1756,7 @@ eval {
1765 1756
 };
1766 1757
 like($@, qr/must be/);
1767 1758
 
1768
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1759
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1769 1760
 $dbi->execute($CREATE_TABLE->{1});
1770 1761
 $dbi->insert_at(
1771 1762
     {key3 => 3},
... ...
@@ -1778,7 +1769,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
1778 1769
 is($dbi->select(table => 'table1')->one->{key3}, 3);
1779 1770
 
1780 1771
 test 'update_at';
1781
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1772
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1782 1773
 $dbi->execute($CREATE_TABLE->{1});
1783 1774
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1784 1775
 $dbi->update_at(
... ...
@@ -1803,7 +1794,7 @@ is($dbi->select(table => 'table1')->one->{key1}, 1);
1803 1794
 is($dbi->select(table => 'table1')->one->{key2}, 2);
1804 1795
 is($dbi->select(table => 'table1')->one->{key3}, 4);
1805 1796
 
1806
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1797
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1807 1798
 $dbi->execute($CREATE_TABLE->{1});
1808 1799
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1809 1800
 $dbi->update_at(
... ...
@@ -1817,7 +1808,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
1817 1808
 is($dbi->select(table => 'table1')->one->{key3}, 4);
1818 1809
 
1819 1810
 test 'select_at';
1820
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1811
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1821 1812
 $dbi->execute($CREATE_TABLE->{1});
1822 1813
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1823 1814
 $result = $dbi->select_at(
... ...
@@ -1893,7 +1884,7 @@ like($@, qr/must be/);
1893 1884
 
1894 1885
 test 'columns';
1895 1886
 use MyDBI1;
1896
-$dbi = MyDBI1->connect($NEW_ARGS->{0});
1887
+$dbi = MyDBI1->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1897 1888
 $model = $dbi->model('book');
1898 1889
 
1899 1890
 
... ...
@@ -1911,7 +1902,7 @@ test 'model delete_at';
1911 1902
         return $self;
1912 1903
     }
1913 1904
 }
1914
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
1905
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1915 1906
 $dbi->execute($CREATE_TABLE->{1});
1916 1907
 $dbi->execute("create table table2 (key1, key2, key3)");
1917 1908
 $dbi->execute("create table table3 (key1, key2, key3)");
... ...
@@ -1926,7 +1917,7 @@ $dbi->model('table1_3')->delete_at(where => [1, 2]);
1926 1917
 is_deeply($dbi->select(table => 'table1')->all, []);
1927 1918
 
1928 1919
 test 'model insert_at';
1929
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
1920
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1930 1921
 $dbi->execute($CREATE_TABLE->{1});
1931 1922
 $dbi->model('table1')->insert_at(
1932 1923
     where => [1, 2],
... ...
@@ -1939,7 +1930,7 @@ is($row->{key2}, 2);
1939 1930
 is($row->{key3}, 3);
1940 1931
 
1941 1932
 test 'model update_at';
1942
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
1933
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1943 1934
 $dbi->execute($CREATE_TABLE->{1});
1944 1935
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1945 1936
 $dbi->model('table1')->update_at(
... ...
@@ -1953,7 +1944,7 @@ is($row->{key2}, 2);
1953 1944
 is($row->{key3}, 4);
1954 1945
 
1955 1946
 test 'model select_at';
1956
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
1947
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1957 1948
 $dbi->execute($CREATE_TABLE->{1});
1958 1949
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1959 1950
 $result = $dbi->model('table1')->select_at(where => [1, 2]);
... ...
@@ -1978,7 +1969,7 @@ test 'mycolumn and column';
1978 1969
         return $self;
1979 1970
     }
1980 1971
 }
1981
-$dbi = MyDBI7->connect($NEW_ARGS->{0});
1972
+$dbi = MyDBI7->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1982 1973
 $dbi->execute($CREATE_TABLE->{0});
1983 1974
 $dbi->execute($CREATE_TABLE->{2});
1984 1975
 $dbi->separator('__');
... ...
@@ -1994,7 +1985,7 @@ is_deeply($result->one,
1994 1985
           {key1 => 1, key2 => 2, 'table2__key1' => 1, 'table2__key3' => 3});
1995 1986
 
1996 1987
 test 'update_param';
1997
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
1988
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1998 1989
 $dbi->execute($CREATE_TABLE->{1});
1999 1990
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2000 1991
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -2013,7 +2004,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
2013 2004
                   "basic");
2014 2005
 
2015 2006
 
2016
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2007
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2017 2008
 $dbi->execute($CREATE_TABLE->{1});
2018 2009
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2019 2010
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -2031,7 +2022,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 33, key4 => 4, key5 => 5},
2031 2022
                   {key1 => 6, key2 => 7,  key3 => 8, key4 => 9, key5 => 10}],
2032 2023
                   "basic");
2033 2024
 
2034
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2025
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2035 2026
 $dbi->execute($CREATE_TABLE->{1});
2036 2027
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2037 2028
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -2055,7 +2046,7 @@ like($@, qr/not safety/);
2055 2046
 
2056 2047
 
2057 2048
 test 'update_param';
2058
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2049
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2059 2050
 $dbi->execute($CREATE_TABLE->{1});
2060 2051
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2061 2052
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -2075,7 +2066,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
2075 2066
 
2076 2067
 
2077 2068
 test 'insert_param';
2078
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2069
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2079 2070
 $dbi->execute($CREATE_TABLE->{1});
2080 2071
 $param = {key1 => 1, key2 => 2};
2081 2072
 $insert_param = $dbi->insert_param($param);
... ...
@@ -2086,7 +2077,7 @@ $dbi->execute($sql, param => $param, table => 'table1');
2086 2077
 is($dbi->select(table => 'table1')->one->{key1}, 1);
2087 2078
 is($dbi->select(table => 'table1')->one->{key2}, 2);
2088 2079
 
2089
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2080
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2090 2081
 $dbi->quote('"');
2091 2082
 $dbi->execute($CREATE_TABLE->{1});
2092 2083
 $param = {key1 => 1, key2 => 2};
... ...
@@ -2103,7 +2094,7 @@ like($@, qr/not safety/);
2103 2094
 
2104 2095
 
2105 2096
 test 'join';
2106
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2097
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2107 2098
 $dbi->execute($CREATE_TABLE->{0});
2108 2099
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2109 2100
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
... ...
@@ -2162,7 +2153,7 @@ $rows = $dbi->select(
2162 2153
 )->all;
2163 2154
 is_deeply($rows, [{table1__key1 => 1}]);
2164 2155
 
2165
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2156
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2166 2157
 $dbi->quote('"');
2167 2158
 $dbi->execute($CREATE_TABLE->{0});
2168 2159
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -2191,7 +2182,7 @@ is_deeply($rows, [{table1_key1 => 1, table2_key1 => 1, key2 => 2, key3 => 5}],
2191 2182
     }
2192 2183
 }
2193 2184
 
2194
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2185
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2195 2186
 $dbi->execute($CREATE_TABLE->{0});
2196 2187
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2197 2188
 $sql = <<"EOS";
... ...
@@ -2211,7 +2202,7 @@ $rows = $dbi->select(
2211 2202
 )->all;
2212 2203
 is_deeply($rows, [{latest_table1__key1 => 1}]);
2213 2204
 
2214
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2205
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2215 2206
 $dbi->execute($CREATE_TABLE->{0});
2216 2207
 $dbi->execute($CREATE_TABLE->{2});
2217 2208
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -2241,7 +2232,7 @@ $result = $dbi->select(
2241 2232
 );
2242 2233
 is_deeply($result->all, [{'table2.key3' => 4}]);
2243 2234
 
2244
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2235
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2245 2236
 $dbi->execute($CREATE_TABLE->{0});
2246 2237
 $dbi->execute($CREATE_TABLE->{2});
2247 2238
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -2260,7 +2251,7 @@ $result = $dbi->select(
2260 2251
 is_deeply($result->all, [{'table2.key3' => 4}]);
2261 2252
 
2262 2253
 test 'mycolumn';
2263
-$dbi = MyDBI8->connect($NEW_ARGS->{0});
2254
+$dbi = MyDBI8->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2264 2255
 $dbi->execute($CREATE_TABLE->{0});
2265 2256
 $dbi->execute($CREATE_TABLE->{2});
2266 2257
 $dbi->setup_model;
... ...
@@ -2325,14 +2316,14 @@ test 'dbi method from model';
2325 2316
         return $self;
2326 2317
     }
2327 2318
 }
2328
-$dbi = MyDBI9->connect($NEW_ARGS->{0});
2319
+$dbi = MyDBI9->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2329 2320
 $dbi->execute($CREATE_TABLE->{0});
2330 2321
 $model = $dbi->model('table1');
2331 2322
 eval{$model->execute('select * from table1')};
2332 2323
 ok(!$@);
2333 2324
 
2334 2325
 test 'column table option';
2335
-$dbi = MyDBI9->connect($NEW_ARGS->{0});
2326
+$dbi = MyDBI9->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2336 2327
 $dbi->execute($CREATE_TABLE->{0});
2337 2328
 $dbi->execute($CREATE_TABLE->{2});
2338 2329
 $dbi->setup_model;
... ...
@@ -2438,7 +2429,7 @@ $row = $result->one;
2438 2429
 is($row->{key1_length}, length $binary);
2439 2430
 
2440 2431
 test 'create_model';
2441
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2432
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2442 2433
 $dbi->execute($CREATE_TABLE->{0});
2443 2434
 $dbi->execute($CREATE_TABLE->{2});
2444 2435
 
... ...
@@ -2472,7 +2463,7 @@ is_deeply($model2->select->one, {key1 => 1, key3 => 3});
2472 2463
 
2473 2464
 test 'model method';
2474 2465
 test 'create_model';
2475
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2466
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2476 2467
 $dbi->execute($CREATE_TABLE->{2});
2477 2468
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 3});
2478 2469
 $model = $dbi->create_model(
... ...
@@ -2500,7 +2491,7 @@ test 'merge_param';
2500 2491
 }
2501 2492
 
2502 2493
 test 'select() param option';
2503
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2494
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2504 2495
 $dbi->execute($CREATE_TABLE->{0});
2505 2496
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2506 2497
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2519,7 +2510,7 @@ is_deeply($rows, [{table1_key1 => 2, key2 => 3, key3 => 5}]);
2519 2510
 
2520 2511
 
2521 2512
 test 'select() wrap option';
2522
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2513
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2523 2514
 $dbi->execute($CREATE_TABLE->{0});
2524 2515
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2525 2516
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2540,7 +2531,7 @@ $dbi->select(
2540 2531
 like($@, qr/array/);
2541 2532
 
2542 2533
 test 'select() string where';
2543
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2534
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2544 2535
 $dbi->execute($CREATE_TABLE->{0});
2545 2536
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2546 2537
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2551,7 +2542,7 @@ $rows = $dbi->select(
2551 2542
 )->all;
2552 2543
 is_deeply($rows, [{key1 => 1, key2 => 2}]);
2553 2544
 
2554
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2545
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2555 2546
 $dbi->execute($CREATE_TABLE->{0});
2556 2547
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2557 2548
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2565,7 +2556,7 @@ $rows = $dbi->select(
2565 2556
 is_deeply($rows, [{key1 => 1, key2 => 2}]);
2566 2557
 
2567 2558
 test 'delete() string where';
2568
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2559
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2569 2560
 $dbi->execute($CREATE_TABLE->{0});
2570 2561
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2571 2562
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2577,7 +2568,7 @@ $dbi->delete(
2577 2568
 $rows = $dbi->select(table => 'table1')->all;
2578 2569
 is_deeply($rows, [{key1 => 2, key2 => 3}]);
2579 2570
 
2580
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2571
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2581 2572
 $dbi->execute($CREATE_TABLE->{0});
2582 2573
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2583 2574
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
... ...
@@ -2593,7 +2584,7 @@ is_deeply($rows, [{key1 => 2, key2 => 3}]);
2593 2584
 
2594 2585
 
2595 2586
 test 'update() string where';
2596
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2587
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2597 2588
 $dbi->execute($CREATE_TABLE->{0});
2598 2589
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2599 2590
 $dbi->update(
... ...
@@ -2605,7 +2596,7 @@ $dbi->update(
2605 2596
 $rows = $dbi->select(table => 'table1')->all;
2606 2597
 is_deeply($rows, [{key1 => 5, key2 => 2}]);
2607 2598
 
2608
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2599
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2609 2600
 $dbi->execute($CREATE_TABLE->{0});
2610 2601
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2611 2602
 $dbi->update(
... ...
@@ -2620,7 +2611,7 @@ $rows = $dbi->select(table => 'table1')->all;
2620 2611
 is_deeply($rows, [{key1 => 5, key2 => 2}]);
2621 2612
 
2622 2613
 test 'insert id and primary_key option';
2623
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2614
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2624 2615
 $dbi->execute($CREATE_TABLE->{1});
2625 2616
 $dbi->insert(
2626 2617
     primary_key => ['key1', 'key2'], 
... ...
@@ -2644,7 +2635,7 @@ is($dbi->select(table => 'table1')->one->{key1}, 0);
2644 2635
 is($dbi->select(table => 'table1')->one->{key2}, 2);
2645 2636
 is($dbi->select(table => 'table1')->one->{key3}, 3);
2646 2637
 
2647
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2638
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2648 2639
 $dbi->execute($CREATE_TABLE->{1});
2649 2640
 $dbi->insert(
2650 2641
     {key3 => 3},
... ...
@@ -2658,7 +2649,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 3);
2658 2649
 
2659 2650
 
2660 2651
 test 'model insert id and primary_key option';
2661
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
2652
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2662 2653
 $dbi->execute($CREATE_TABLE->{1});
2663 2654
 $dbi->model('table1')->insert(
2664 2655
     id => [1, 2],
... ...
@@ -2670,7 +2661,7 @@ is($row->{key1}, 1);
2670 2661
 is($row->{key2}, 2);
2671 2662
 is($row->{key3}, 3);
2672 2663
 
2673
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
2664
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2674 2665
 $dbi->execute($CREATE_TABLE->{1});
2675 2666
 $dbi->model('table1')->insert(
2676 2667
     {key3 => 3},
... ...
@@ -2683,7 +2674,7 @@ is($row->{key2}, 2);
2683 2674
 is($row->{key3}, 3);
2684 2675
 
2685 2676
 test 'update and id option';
2686
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2677
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2687 2678
 $dbi->execute($CREATE_TABLE->{1});
2688 2679
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2689 2680
 $dbi->update(
... ...
@@ -2708,7 +2699,7 @@ is($dbi->select(table => 'table1')->one->{key1}, 0);
2708 2699
 is($dbi->select(table => 'table1')->one->{key2}, 2);
2709 2700
 is($dbi->select(table => 'table1')->one->{key3}, 4);
2710 2701
 
2711
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2702
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2712 2703
 $dbi->execute($CREATE_TABLE->{1});
2713 2704
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2714 2705
 $dbi->update(
... ...
@@ -2723,7 +2714,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 4);
2723 2714
 
2724 2715
 
2725 2716
 test 'model update and id option';
2726
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
2717
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2727 2718
 $dbi->execute($CREATE_TABLE->{1});
2728 2719
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2729 2720
 $dbi->model('table1')->update(
... ...
@@ -2738,7 +2729,7 @@ is($row->{key3}, 4);
2738 2729
 
2739 2730
 
2740 2731
 test 'delete and id option';
2741
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2732
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2742 2733
 $dbi->execute($CREATE_TABLE->{1});
2743 2734
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2744 2735
 $dbi->delete(
... ...
@@ -2758,7 +2749,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
2758 2749
 
2759 2750
 
2760 2751
 test 'model delete and id option';
2761
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
2752
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2762 2753
 $dbi->execute($CREATE_TABLE->{1});
2763 2754
 $dbi->execute("create table table2 (key1, key2, key3)");
2764 2755
 $dbi->execute("create table table3 (key1, key2, key3)");
... ...
@@ -2774,7 +2765,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
2774 2765
 
2775 2766
 
2776 2767
 test 'select and id option';
2777
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
2768
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2778 2769
 $dbi->execute($CREATE_TABLE->{1});
2779 2770
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2780 2771
 $result = $dbi->select(
... ...
@@ -2813,7 +2804,7 @@ is($row->{key3}, 3);
2813 2804
 
2814 2805
 
2815 2806
 test 'model select_at';
2816
-$dbi = MyDBI6->connect($NEW_ARGS->{0});
2807
+$dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2817 2808
 $dbi->execute($CREATE_TABLE->{1});
2818 2809
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2819 2810
 $result = $dbi->model('table1')->select(id => [1, 2]);
... ...
@@ -2823,7 +2814,7 @@ is($row->{key2}, 2);
2823 2814
 is($row->{key3}, 3);
2824 2815
 
2825 2816
 test 'column separator is default .';
2826
-$dbi = MyDBI7->connect($NEW_ARGS->{0});
2817
+$dbi = MyDBI7->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2827 2818
 $dbi->execute($CREATE_TABLE->{0});
2828 2819
 $dbi->execute($CREATE_TABLE->{2});
2829 2820
 $dbi->setup_model;
... ...
@@ -3242,7 +3233,7 @@ $result = $dbi->select(table => 'table1');
3242 3233
 is($result->type_rule2_on->fetch_first->[0], '1bde');
3243 3234
 
3244 3235
 test 'separator';
3245
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3236
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3246 3237
 $dbi->execute($CREATE_TABLE->{0});
3247 3238
 $dbi->execute($CREATE_TABLE->{2});
3248 3239
 
... ...
@@ -3299,7 +3290,7 @@ is_deeply($model2->select->one, {key1 => 1, key3 => 3});
3299 3290
 
3300 3291
 
3301 3292
 test 'filter_off';
3302
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3293
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3303 3294
 $dbi->execute($CREATE_TABLE->{0});
3304 3295
 $dbi->execute($CREATE_TABLE->{2});
3305 3296
 
... ...
@@ -3318,12 +3309,12 @@ $result->filter(key1 => sub { $_[0] * 2 });
3318 3309
 is_deeply($result->one, {key1 => 2});
3319 3310
 
3320 3311
 test 'available_date_type';
3321
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3312
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3322 3313
 ok($dbi->can('available_data_type'));
3323 3314
 
3324 3315
 
3325 3316
 test 'select prefix option';
3326
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3317
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3327 3318
 $dbi->execute($CREATE_TABLE->{0});
3328 3319
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
3329 3320
 $rows = $dbi->select(prefix => 'key1,', column => 'key2', table => 'table1')->all;
... ...
@@ -3331,7 +3322,7 @@ is_deeply($rows, [{key1 => 1, key2 => 2}], "table");
3331 3322
 
3332 3323
 
3333 3324
 test 'separator';
3334
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3325
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3335 3326
 is($dbi->separator, '.');
3336 3327
 $dbi->separator('-');
3337 3328
 is($dbi->separator, '-');
... ...
@@ -3342,7 +3333,7 @@ like($@, qr/Separator/);
3342 3333
 
3343 3334
 
3344 3335
 test 'map_param';
3345
-$dbi = DBIx::Custom->connect($NEW_ARGS->{0});
3336
+$dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3346 3337
 $param = $dbi->map_param(
3347 3338
     {id => 1, author => 'Ken', price => 1900},
3348 3339
     id => 'book.id',
... ...
@@ -3461,7 +3452,7 @@ test 'DBIx::Custom header';
3461 3452
 }
3462 3453
 
3463 3454
 test 'Named placeholder :name(operater) syntax';
3464
-$dbi->execute($DROP_TABLE->{0});
3455
+$dbi->execute('drop table table1');
3465 3456
 $dbi->execute($CREATE_TABLE->{1});
3466 3457
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
3467 3458
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
... ...
@@ -3491,7 +3482,7 @@ $rows = $result->all;
3491 3482
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}]);
3492 3483
 
3493 3484
 test 'high perfomance way';
3494
-$dbi->execute($DROP_TABLE->{0});
3485
+$dbi->execute('drop table table1');
3495 3486
 $dbi->execute("create table table1 (ab, bc, ik, hi, ui, pq, dc);");
3496 3487
 $rows = [
3497 3488
     {ab => 1, bc => 2, ik => 3, hi => 4, ui => 5, pq => 6, dc => 7},
... ...
@@ -3511,7 +3502,7 @@ $rows = [
3511 3502
     );
3512 3503
 }
3513 3504
 
3514
-$dbi->execute($DROP_TABLE->{0});
3505
+$dbi->execute('drop table table1');
3515 3506
 $dbi->execute("create table table1 (ab, bc, ik, hi, ui, pq, dc);");
3516 3507
 $rows = [
3517 3508
     {ab => 1, bc => 2, ik => 3, hi => 4, ui => 5, pq => 6, dc => 7},