...
|
...
|
@@ -243,7 +243,7 @@ eval { $dbi->execute("drop table $table1") };
|
243
|
243
|
$dbi->execute($create_table1);
|
244
|
244
|
$reuse = {};
|
245
|
245
|
for my $i (1 .. 2) {
|
246
|
|
- $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, reuse => $reuse);
|
|
246
|
+ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, reuse => $reuse);
|
247
|
247
|
}
|
248
|
248
|
$rows = $dbi->select(table => $table1)->all;
|
249
|
249
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 1, $key2 => 2}]);
|
...
|
...
|
@@ -268,7 +268,7 @@ is_deeply($model->select->all, [{$key1 => 1, $key2 => 2}]);
|
268
|
268
|
|
269
|
269
|
test 'DBIx::Custom::Result test';
|
270
|
270
|
$dbi->delete_all(table => $table1);
|
271
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
271
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
272
|
272
|
$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
273
|
273
|
$source = "select $key1, $key2 from $table1";
|
274
|
274
|
$query = $dbi->create_query($source);
|
...
|
...
|
@@ -298,13 +298,13 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "all");
|
298
|
298
|
test 'Insert query return value';
|
299
|
299
|
$source = "insert into $table1 {insert_param $key1 $key2}";
|
300
|
300
|
$query = $dbi->execute($source, {}, query => 1);
|
301
|
|
-$ret_val = $dbi->execute($query, param => {$key1 => 1, $key2 => 2});
|
|
301
|
+$ret_val = $dbi->execute($query, {$key1 => 1, $key2 => 2});
|
302
|
302
|
ok($ret_val);
|
303
|
303
|
|
304
|
304
|
test 'Direct query';
|
305
|
305
|
$dbi->delete_all(table => $table1);
|
306
|
306
|
$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
307
|
|
-$dbi->execute($insert_source, param => {$key1 => 1, $key2 => 2});
|
|
307
|
+$dbi->execute($insert_source, {$key1 => 1, $key2 => 2});
|
308
|
308
|
$result = $dbi->execute("select * from $table1");
|
309
|
309
|
$rows = $result->all;
|
310
|
310
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
|
...
|
...
|
@@ -317,7 +317,7 @@ $dbi->register_filter(twice => sub { $_[0] * 2},
|
317
|
317
|
$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
318
|
318
|
$insert_query = $dbi->execute($insert_source, {}, query => 1);
|
319
|
319
|
$insert_query->filter({$key1 => 'twice'});
|
320
|
|
-$dbi->execute($insert_query, param => {$key1 => 1, $key2 => 2});
|
|
320
|
+$dbi->execute($insert_query, {$key1 => 1, $key2 => 2});
|
321
|
321
|
$result = $dbi->execute("select * from $table1");
|
322
|
322
|
$rows = $result->filter({$key2 => 'three_times'})->all;
|
323
|
323
|
is_deeply($rows, [{$key1 => 2, $key2 => 6}], "filter fetch_filter");
|
...
|
...
|
@@ -326,23 +326,23 @@ test 'Filter in';
|
326
|
326
|
$dbi->delete_all(table => $table1);
|
327
|
327
|
$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
328
|
328
|
$insert_query = $dbi->execute($insert_source, {}, query => 1);
|
329
|
|
-$dbi->execute($insert_query, param => {$key1 => 2, $key2 => 4});
|
|
329
|
+$dbi->execute($insert_query, {$key1 => 2, $key2 => 4});
|
330
|
330
|
$select_source = "select * from $table1 where {in $table1.$key1 2} and {in $table1.$key2 2}";
|
331
|
331
|
$select_query = $dbi->execute($select_source,{}, query => 1);
|
332
|
332
|
$select_query->filter({"$table1.$key1" => 'twice'});
|
333
|
|
-$result = $dbi->execute($select_query, param => {"$table1.$key1" => [1,5], "$table1.$key2" => [2,4]});
|
|
333
|
+$result = $dbi->execute($select_query, {"$table1.$key1" => [1,5], "$table1.$key2" => [2,4]});
|
334
|
334
|
$rows = $result->all;
|
335
|
335
|
is_deeply($rows, [{$key1 => 2, $key2 => 4}], "filter");
|
336
|
336
|
|
337
|
337
|
test 'DBIx::Custom::SQLTemplate basic tag';
|
338
|
338
|
eval { $dbi->execute("drop table $table1") };
|
339
|
339
|
$dbi->execute($create_table1_2);
|
340
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
341
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
340
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
341
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
342
|
342
|
|
343
|
343
|
$source = "select * from $table1 where $key1 = :$key1 and {<> $key2} and {< $key3} and {> $key4} and {>= $key5}";
|
344
|
344
|
$query = $dbi->execute($source, {}, query => 1);
|
345
|
|
-$result = $dbi->execute($query, param => {$key1 => 1, $key2 => 3, $key3 => 4, $key4 => 3, $key5 => 5});
|
|
345
|
+$result = $dbi->execute($query, {$key1 => 1, $key2 => 3, $key3 => 4, $key4 => 3, $key5 => 5});
|
346
|
346
|
$rows = $result->all;
|
347
|
347
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic tag1");
|
348
|
348
|
|
...
|
...
|
@@ -354,26 +354,26 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}],
|
354
|
354
|
|
355
|
355
|
$source = "select * from $table1 where {<= $key1} and {like $key2}";
|
356
|
356
|
$query = $dbi->execute($source, {}, query => 1);
|
357
|
|
-$result = $dbi->execute($query, param => {$key1 => 1, $key2 => '%2%'});
|
|
357
|
+$result = $dbi->execute($query, {$key1 => 1, $key2 => '%2%'});
|
358
|
358
|
$rows = $result->all;
|
359
|
359
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic tag2");
|
360
|
360
|
|
361
|
361
|
test 'DIB::Custom::SQLTemplate in tag';
|
362
|
362
|
eval { $dbi->execute("drop table $table1") };
|
363
|
363
|
$dbi->execute($create_table1_2);
|
364
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
365
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
364
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
365
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
366
|
366
|
|
367
|
367
|
$source = "select * from $table1 where {in $key1 2}";
|
368
|
368
|
$query = $dbi->execute($source, {}, query => 1);
|
369
|
|
-$result = $dbi->execute($query, param => {$key1 => [9, 1]});
|
|
369
|
+$result = $dbi->execute($query, {$key1 => [9, 1]});
|
370
|
370
|
$rows = $result->all;
|
371
|
371
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic");
|
372
|
372
|
|
373
|
373
|
test 'DBIx::Custom::SQLTemplate insert tag';
|
374
|
374
|
$dbi->delete_all(table => $table1);
|
375
|
375
|
$insert_source = "insert into $table1 {insert_param $key1 $key2 $key3 $key4 $key5}";
|
376
|
|
-$dbi->execute($insert_source, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
|
376
|
+$dbi->execute($insert_source, {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
377
|
377
|
|
378
|
378
|
$result = $dbi->execute("select * from $table1");
|
379
|
379
|
$rows = $result->all;
|
...
|
...
|
@@ -382,11 +382,11 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}],
|
382
|
382
|
test 'DBIx::Custom::SQLTemplate update tag';
|
383
|
383
|
$dbi->delete_all(table => $table1);
|
384
|
384
|
$insert_source = "insert into $table1 {insert_param $key1 $key2 $key3 $key4 $key5}";
|
385
|
|
-$dbi->execute($insert_source, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
386
|
|
-$dbi->execute($insert_source, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
385
|
+$dbi->execute($insert_source, {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
|
386
|
+$dbi->execute($insert_source, {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
387
|
387
|
|
388
|
388
|
$update_source = "update $table1 {update_param $key1 $key2 $key3 $key4} where {= $key5}";
|
389
|
|
-$dbi->execute($update_source, param => {$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5});
|
|
389
|
+$dbi->execute($update_source, {$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5});
|
390
|
390
|
|
391
|
391
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
392
|
392
|
$rows = $result->all;
|
...
|
...
|
@@ -396,28 +396,28 @@ is_deeply($rows, [{$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5},
|
396
|
396
|
test 'Named placeholder';
|
397
|
397
|
eval { $dbi->execute("drop table $table1") };
|
398
|
398
|
$dbi->execute($create_table1_2);
|
399
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
400
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
399
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
400
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
401
|
401
|
|
402
|
402
|
$source = "select * from $table1 where $key1 = :$key1 and $key2 = :$key2";
|
403
|
|
-$result = $dbi->execute($source, param => {$key1 => 1, $key2 => 2});
|
|
403
|
+$result = $dbi->execute($source, {$key1 => 1, $key2 => 2});
|
404
|
404
|
$rows = $result->all;
|
405
|
405
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}]);
|
406
|
406
|
|
407
|
407
|
$source = "select * from $table1 where $key1 = \n:$key1\n and $key2 = :$key2";
|
408
|
|
-$result = $dbi->execute($source, param => {$key1 => 1, $key2 => 2});
|
|
408
|
+$result = $dbi->execute($source, {$key1 => 1, $key2 => 2});
|
409
|
409
|
$rows = $result->all;
|
410
|
410
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}]);
|
411
|
411
|
|
412
|
412
|
$source = "select * from $table1 where $key1 = :$key1 or $key1 = :$key1";
|
413
|
|
-$result = $dbi->execute($source, param => {$key1 => [1, 2]});
|
|
413
|
+$result = $dbi->execute($source, {$key1 => [1, 2]});
|
414
|
414
|
$rows = $result->all;
|
415
|
415
|
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}]);
|
416
|
416
|
|
417
|
417
|
$source = "select * from $table1 where $key1 = :$table1.$key1 and $key2 = :$table1.$key2";
|
418
|
418
|
$result = $dbi->execute(
|
419
|
419
|
$source,
|
420
|
|
- param => {"$table1.$key1" => 1, "$table1.$key2" => 1},
|
|
420
|
+ {"$table1.$key1" => 1, "$table1.$key2" => 1},
|
421
|
421
|
filter => {"$table1.$key2" => sub { $_[0] * 2 }}
|
422
|
422
|
);
|
423
|
423
|
$rows = $result->all;
|
...
|
...
|
@@ -425,11 +425,11 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}])
|
425
|
425
|
|
426
|
426
|
eval { $dbi->execute("drop table $table1") };
|
427
|
427
|
$dbi->execute($create_table1);
|
428
|
|
-$dbi->insert(table => $table1, param => {$key1 => '2011-10-14 12:19:18', $key2 => 2});
|
|
428
|
+$dbi->insert({$key1 => '2011-10-14 12:19:18', $key2 => 2}, table => $table1);
|
429
|
429
|
$source = "select * from $table1 where $key1 = '2011-10-14 12:19:18' and $key2 = :$key2";
|
430
|
430
|
$result = $dbi->execute(
|
431
|
431
|
$source,
|
432
|
|
- param => {$key2 => 2},
|
|
432
|
+ {$key2 => 2},
|
433
|
433
|
);
|
434
|
434
|
|
435
|
435
|
$rows = $result->all;
|
...
|
...
|
@@ -437,11 +437,11 @@ like($rows->[0]->{$key1}, qr/2011-10-14 12:19:18/);
|
437
|
437
|
is($rows->[0]->{$key2}, 2);
|
438
|
438
|
|
439
|
439
|
$dbi->delete_all(table => $table1);
|
440
|
|
-$dbi->insert(table => $table1, param => {$key1 => 'a:b c:d', $key2 => 2});
|
|
440
|
+$dbi->insert({$key1 => 'a:b c:d', $key2 => 2}, table => $table1);
|
441
|
441
|
$source = "select * from $table1 where $key1 = 'a\\:b c\\:d' and $key2 = :$key2";
|
442
|
442
|
$result = $dbi->execute(
|
443
|
443
|
$source,
|
444
|
|
- param => {$key2 => 2},
|
|
444
|
+ {$key2 => 2},
|
445
|
445
|
);
|
446
|
446
|
$rows = $result->all;
|
447
|
447
|
is_deeply($rows, [{$key1 => 'a:b c:d', $key2 => 2}]);
|
...
|
...
|
@@ -456,8 +456,8 @@ ok($@, "create_query invalid SQL template");
|
456
|
456
|
test 'insert';
|
457
|
457
|
eval { $dbi->execute("drop table $table1") };
|
458
|
458
|
$dbi->execute($create_table1);
|
459
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
460
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
459
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
460
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
461
|
461
|
$result = $dbi->execute("select * from $table1");
|
462
|
462
|
$rows = $result->all;
|
463
|
463
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
...
|
...
|
@@ -468,7 +468,7 @@ $dbi->register_filter(
|
468
|
468
|
three_times => sub { $_[0] * 3 }
|
469
|
469
|
);
|
470
|
470
|
$dbi->default_bind_filter('twice');
|
471
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, filter => {$key1 => 'three_times'});
|
|
471
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, filter => {$key1 => 'three_times'});
|
472
|
472
|
$result = $dbi->execute("select * from $table1");
|
473
|
473
|
$rows = $result->all;
|
474
|
474
|
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "filter");
|
...
|
...
|
@@ -476,17 +476,17 @@ $dbi->default_bind_filter(undef);
|
476
|
476
|
|
477
|
477
|
eval { $dbi->execute("drop table $table1") };
|
478
|
478
|
$dbi->execute($create_table1);
|
479
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, append => ' ');
|
|
479
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1, append => ' ');
|
480
|
480
|
$rows = $dbi->select(table => $table1)->all;
|
481
|
481
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}], 'insert append');
|
482
|
482
|
|
483
|
|
-eval{$dbi->insert(table => 'table', param => {';' => 1})};
|
|
483
|
+eval{$dbi->insert({';' => 1}, table => 'table')};
|
484
|
484
|
like($@, qr/safety/);
|
485
|
485
|
|
486
|
486
|
eval { $dbi->execute("drop table ${q}table$p") };
|
487
|
487
|
$dbi->execute($create_table_reserved);
|
488
|
488
|
$dbi->apply_filter('table', select => {out => sub { $_[0] * 2}});
|
489
|
|
-$dbi->insert(table => 'table', param => {select => 1});
|
|
489
|
+$dbi->insert({select => 1}, table => 'table');
|
490
|
490
|
$result = $dbi->execute("select * from ${q}table$p");
|
491
|
491
|
$rows = $result->all;
|
492
|
492
|
is_deeply($rows, [{select => 2, update => undef}], "reserved word");
|
...
|
...
|
@@ -501,17 +501,17 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
501
|
501
|
|
502
|
502
|
eval { $dbi->execute("drop table $table1") };
|
503
|
503
|
$dbi->execute($create_table1);
|
504
|
|
-$dbi->insert(table => $table1, param => {$key1 => \"'1'", $key2 => 2});
|
505
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
504
|
+$dbi->insert({$key1 => \"'1'", $key2 => 2}, table => $table1);
|
|
505
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
506
|
506
|
$result = $dbi->execute("select * from $table1");
|
507
|
507
|
$rows = $result->all;
|
508
|
508
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
509
|
509
|
|
510
|
510
|
eval { $dbi->execute("drop table $table1") };
|
511
|
511
|
$dbi->execute($create_table1);
|
512
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2},
|
|
512
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1,
|
513
|
513
|
wrap => {$key1 => sub { "$_[0] - 1" }});
|
514
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
514
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
515
|
515
|
$result = $dbi->execute("select * from $table1");
|
516
|
516
|
$rows = $result->all;
|
517
|
517
|
is_deeply($rows, [{$key1 => 0, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
...
|
...
|
@@ -521,7 +521,7 @@ $dbi->execute($create_table1);
|
521
|
521
|
$dbi->insert_timestamp(
|
522
|
522
|
$key1 => '5'
|
523
|
523
|
);
|
524
|
|
-$dbi->insert(table => $table1, param => {$key2 => 2}, timestamp => 1);
|
|
524
|
+$dbi->insert({$key2 => 2}, table => $table1, timestamp => 1);
|
525
|
525
|
$result = $dbi->execute("select * from $table1");
|
526
|
526
|
$rows = $result->all;
|
527
|
527
|
is_deeply($rows, [{$key1 => 5, $key2 => 2}], "basic");
|
...
|
...
|
@@ -549,7 +549,7 @@ is($rows->[0]->{$key1}, $rows->[0]->{$key2});
|
549
|
549
|
eval { $dbi->execute("drop table $table1") };
|
550
|
550
|
$dbi->execute($create_table1_2);
|
551
|
551
|
$param = {$key1 => 1};
|
552
|
|
-$dbi->insert(table => $table1, param => $param, created_at => $key2);
|
|
552
|
+$dbi->insert($param, table => $table1, created_at => $key2);
|
553
|
553
|
$result = $dbi->select(table => $table1);
|
554
|
554
|
is_deeply($param, {$key1 => 1});
|
555
|
555
|
$row = $result->one;
|
...
|
...
|
@@ -559,7 +559,7 @@ like($row->{$key2}, qr/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
559
|
559
|
eval { $dbi->execute("drop table $table1") };
|
560
|
560
|
$dbi->execute($create_table1_2);
|
561
|
561
|
$param = {$key1 => 1};
|
562
|
|
-$dbi->insert(table => $table1, param => $param, updated_at => $key3);
|
|
562
|
+$dbi->insert($param, table => $table1, updated_at => $key3);
|
563
|
563
|
$result = $dbi->select(table => $table1);
|
564
|
564
|
is_deeply($param, {$key1 => 1});
|
565
|
565
|
$row = $result->one;
|
...
|
...
|
@@ -569,7 +569,7 @@ like($row->{$key3}, qr/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
569
|
569
|
eval { $dbi->execute("drop table $table1") };
|
570
|
570
|
$dbi->execute($create_table1_2);
|
571
|
571
|
$param = {$key1 => 1};
|
572
|
|
-$dbi->insert(table => $table1, param => $param, created_at => $key2, updated_at => $key3);
|
|
572
|
+$dbi->insert($param, table => $table1, created_at => $key2, updated_at => $key3);
|
573
|
573
|
$result = $dbi->select(table => $table1);
|
574
|
574
|
is_deeply($param, {$key1 => 1});
|
575
|
575
|
$row = $result->one;
|
...
|
...
|
@@ -670,8 +670,8 @@ $dbi->default_bind_filter(undef);
|
670
|
670
|
test 'update';
|
671
|
671
|
eval { $dbi->execute("drop table $table1") };
|
672
|
672
|
$dbi->execute($create_table1_2);
|
673
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
674
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
673
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
674
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
675
|
675
|
$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1});
|
676
|
676
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
677
|
677
|
$rows = $result->all;
|
...
|
...
|
@@ -680,8 +680,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
680
|
680
|
"basic");
|
681
|
681
|
|
682
|
682
|
$dbi->execute("delete from $table1");
|
683
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
684
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
683
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
684
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
685
|
685
|
$dbi->update(table => $table1, param => {$key2 => 12}, where => {$key2 => 2, $key3 => 3});
|
686
|
686
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
687
|
687
|
$rows = $result->all;
|
...
|
...
|
@@ -697,8 +697,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
|
697
|
697
|
"update key same as search key : param is array ref");
|
698
|
698
|
|
699
|
699
|
$dbi->execute("delete from $table1");
|
700
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
701
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
700
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
701
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
702
|
702
|
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
703
|
703
|
$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1},
|
704
|
704
|
filter => {$key2 => sub { $_[0] * 2 }});
|
...
|
...
|
@@ -715,7 +715,7 @@ like($@, qr/where/, "not contain where");
|
715
|
715
|
|
716
|
716
|
eval { $dbi->execute("drop table $table1") };
|
717
|
717
|
$dbi->execute($create_table1);
|
718
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
718
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
719
|
719
|
$where = $dbi->where;
|
720
|
720
|
$where->clause(['and', "$key1 = :$key1", "$key2 = :$key2"]);
|
721
|
721
|
$where->param({$key1 => 1, $key2 => 2});
|
...
|
...
|
@@ -725,7 +725,7 @@ is_deeply($result->all, [{$key1 => 3, $key2 => 2}], 'update() where');
|
725
|
725
|
|
726
|
726
|
eval { $dbi->execute("drop table $table1") };
|
727
|
727
|
$dbi->execute($create_table1);
|
728
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
728
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
729
|
729
|
$dbi->update(
|
730
|
730
|
table => $table1,
|
731
|
731
|
param => {$key1 => 3},
|
...
|
...
|
@@ -739,7 +739,7 @@ is_deeply($result->all, [{$key1 => 3, $key2 => 2}], 'update() where');
|
739
|
739
|
|
740
|
740
|
eval { $dbi->execute("drop table $table1") };
|
741
|
741
|
$dbi->execute($create_table1);
|
742
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
742
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
743
|
743
|
$where = $dbi->where;
|
744
|
744
|
$where->clause(['and', "$key2 = :$key2"]);
|
745
|
745
|
$where->param({$key2 => 2});
|
...
|
...
|
@@ -779,8 +779,8 @@ is_deeply($rows, [{select => 2, update => 6}], "reserved word");
|
779
|
779
|
|
780
|
780
|
eval { $dbi->execute("drop table $table1") };
|
781
|
781
|
$dbi->execute($create_table1_2);
|
782
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
783
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
782
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
783
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
784
|
784
|
$dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1});
|
785
|
785
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
786
|
786
|
$rows = $result->all;
|
...
|
...
|
@@ -790,8 +790,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
790
|
790
|
|
791
|
791
|
eval { $dbi->execute("drop table $table1") };
|
792
|
792
|
$dbi->execute($create_table1_2);
|
793
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
794
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
793
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
794
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
795
|
795
|
$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1},
|
796
|
796
|
wrap => {$key2 => sub { "$_[0] - 1" }});
|
797
|
797
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
...
|
...
|
@@ -802,8 +802,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 10, $key3 => 3, $key4 => 4, $key5 => 5},
|
802
|
802
|
|
803
|
803
|
eval { $dbi->execute("drop table $table1") };
|
804
|
804
|
$dbi->execute($create_table1_2);
|
805
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
806
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
805
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
806
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
807
|
807
|
$dbi->update(table => $table1, param => {$key2 => \"'11'"}, where => {$key1 => 1});
|
808
|
808
|
$result = $dbi->execute("select * from $table1 order by $key1");
|
809
|
809
|
$rows = $result->all;
|
...
|
...
|
@@ -816,7 +816,7 @@ $dbi->execute($create_table1);
|
816
|
816
|
$dbi->update_timestamp(
|
817
|
817
|
$key1 => '5'
|
818
|
818
|
);
|
819
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
819
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
820
|
820
|
$dbi->update(table => $table1, timestamp => 1, where => {$key2 => 2});
|
821
|
821
|
$result = $dbi->execute("select * from $table1");
|
822
|
822
|
$rows = $result->all;
|
...
|
...
|
@@ -827,7 +827,7 @@ $dbi->execute($create_table1);
|
827
|
827
|
$dbi->update_timestamp(
|
828
|
828
|
[$key1, $key2] => sub { '5' }
|
829
|
829
|
);
|
830
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
830
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
831
|
831
|
$dbi->update_all(table => $table1, timestamp => 1);
|
832
|
832
|
$result = $dbi->execute("select * from $table1");
|
833
|
833
|
$rows = $result->all;
|
...
|
...
|
@@ -838,7 +838,7 @@ $dbi->execute($create_table1);
|
838
|
838
|
$dbi->update_timestamp(
|
839
|
839
|
[$key1, $key2] => sub { "" . DBIx::Custom->new }
|
840
|
840
|
);
|
841
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
841
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
842
|
842
|
$dbi->update_all(table => $table1, timestamp => 1);
|
843
|
843
|
$result = $dbi->execute("select * from $table1");
|
844
|
844
|
$rows = $result->all;
|
...
|
...
|
@@ -846,8 +846,8 @@ is($rows->[0]->{$key1}, $rows->[0]->{$key2});
|
846
|
846
|
|
847
|
847
|
eval { $dbi->execute("drop table $table1") };
|
848
|
848
|
$dbi->execute($create_table1_2);
|
849
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
850
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
849
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
850
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
851
|
851
|
$param = {$key2 => 11};
|
852
|
852
|
$dbi->update($param, table => $table1, where => {$key1 => 1});
|
853
|
853
|
is_deeply($param, {$key2 => 11});
|
...
|
...
|
@@ -859,8 +859,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
859
|
859
|
|
860
|
860
|
eval { $dbi->execute("drop table $table1") };
|
861
|
861
|
$dbi->execute($create_table1_2);
|
862
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
863
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
862
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
863
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
864
|
864
|
$param = {$key2 => 11};
|
865
|
865
|
$dbi->update($param, table => $table1, where => {$key2 => 2});
|
866
|
866
|
is_deeply($param, {$key2 => 11});
|
...
|
...
|
@@ -907,8 +907,8 @@ like($row->{$key2}, qr/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);
|
907
|
907
|
test 'update_all';
|
908
|
908
|
eval { $dbi->execute("drop table $table1") };
|
909
|
909
|
$dbi->execute($create_table1_2);
|
910
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
911
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
910
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
911
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
912
|
912
|
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
913
|
913
|
$dbi->update_all(table => $table1, param => {$key2 => 10}, filter => {$key2 => 'twice'});
|
914
|
914
|
$result = $dbi->execute("select * from $table1");
|
...
|
...
|
@@ -921,16 +921,16 @@ is_deeply($rows, [{$key1 => 1, $key2 => 20, $key3 => 3, $key4 => 4, $key5 => 5},
|
921
|
921
|
test 'delete';
|
922
|
922
|
eval { $dbi->execute("drop table $table1") };
|
923
|
923
|
$dbi->execute($create_table1);
|
924
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
925
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
924
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
925
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
926
|
926
|
$dbi->delete(table => $table1, where => {$key1 => 1});
|
927
|
927
|
$result = $dbi->execute("select * from $table1");
|
928
|
928
|
$rows = $result->all;
|
929
|
929
|
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "basic");
|
930
|
930
|
|
931
|
931
|
$dbi->execute("delete from $table1");
|
932
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
933
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
932
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
933
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
934
|
934
|
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
935
|
935
|
$dbi->delete(table => $table1, where => {$key2 => 1}, filter => {$key2 => 'twice'});
|
936
|
936
|
$result = $dbi->execute("select * from $table1");
|
...
|
...
|
@@ -940,16 +940,16 @@ is_deeply($rows, [{$key1 => 3, $key2 => 4}], "filter");
|
940
|
940
|
$dbi->delete(table => $table1, where => {$key1 => 1}, append => ' ');
|
941
|
941
|
|
942
|
942
|
$dbi->delete_all(table => $table1);
|
943
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
944
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
943
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
944
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
945
|
945
|
$dbi->delete(table => $table1, where => {$key1 => 1, $key2 => 2});
|
946
|
946
|
$rows = $dbi->select(table => $table1)->all;
|
947
|
947
|
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "delete multi key");
|
948
|
948
|
|
949
|
949
|
eval { $dbi->execute("drop table $table1") };
|
950
|
950
|
$dbi->execute($create_table1);
|
951
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
952
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
951
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
952
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
953
|
953
|
$where = $dbi->where;
|
954
|
954
|
$where->clause(['and', "$key1 = :$key1", "$key2 = :$key2"]);
|
955
|
955
|
$where->param({ke1 => 1, $key2 => 2});
|
...
|
...
|
@@ -959,8 +959,8 @@ is_deeply($result->all, [{$key1 => 3, $key2 => 4}], 'delete() where');
|
959
|
959
|
|
960
|
960
|
eval { $dbi->execute("drop table $table1") };
|
961
|
961
|
$dbi->execute($create_table1);
|
962
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
963
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
962
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
963
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
964
|
964
|
$dbi->delete(
|
965
|
965
|
table => $table1,
|
966
|
966
|
where => [
|
...
|
...
|
@@ -973,7 +973,7 @@ is_deeply($result->all, [{$key1 => 3, $key2 => 4}], 'delete() where');
|
973
|
973
|
|
974
|
974
|
eval { $dbi->execute("drop table $table1") };
|
975
|
975
|
$dbi->execute($create_table1);
|
976
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
976
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
977
|
977
|
$dbi->delete(table => $table1, where => {$key1 => 1}, prefix => ' ');
|
978
|
978
|
$result = $dbi->execute("select * from $table1");
|
979
|
979
|
$rows = $result->all;
|
...
|
...
|
@@ -1002,8 +1002,8 @@ is_deeply($rows, [], "reserved word");
|
1002
|
1002
|
test 'delete_all';
|
1003
|
1003
|
eval { $dbi->execute("drop table $table1") };
|
1004
|
1004
|
$dbi->execute($create_table1);
|
1005
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1006
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1005
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1006
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1007
|
1007
|
$dbi->delete_all(table => $table1);
|
1008
|
1008
|
$result = $dbi->execute("select * from $table1");
|
1009
|
1009
|
$rows = $result->all;
|
...
|
...
|
@@ -1013,8 +1013,8 @@ is_deeply($rows, [], "basic");
|
1013
|
1013
|
test 'select';
|
1014
|
1014
|
eval { $dbi->execute("drop table $table1") };
|
1015
|
1015
|
$dbi->execute($create_table1);
|
1016
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1017
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1016
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1017
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1018
|
1018
|
$rows = $dbi->select(table => $table1)->all;
|
1019
|
1019
|
is_deeply($rows, [{$key1 => 1, $key2 => 2},
|
1020
|
1020
|
{$key1 => 3, $key2 => 4}], "table");
|
...
|
...
|
@@ -1068,7 +1068,7 @@ $dbi->register_filter(
|
1068
|
1068
|
);
|
1069
|
1069
|
$dbi->default_fetch_filter('twice');
|
1070
|
1070
|
$dbi->execute($create_table1);
|
1071
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1071
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1072
|
1072
|
$result = $dbi->select(table => $table1);
|
1073
|
1073
|
$result->filter({$key1 => 'three_times'});
|
1074
|
1074
|
$row = $result->one;
|
...
|
...
|
@@ -1089,7 +1089,7 @@ eval { $dbi->execute("drop table $table1") };
|
1089
|
1089
|
$dbi->execute($create_table1);
|
1090
|
1090
|
$dbi->begin_work;
|
1091
|
1091
|
$dbi->dbh->{AutoCommit} = 0;
|
1092
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1092
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1093
|
1093
|
$dbi->rollback;
|
1094
|
1094
|
$dbi->dbh->{AutoCommit} = 1;
|
1095
|
1095
|
|
...
|
...
|
@@ -1102,7 +1102,7 @@ eval { $dbi->execute("drop table $table1") };
|
1102
|
1102
|
$dbi->execute($create_table1);
|
1103
|
1103
|
$dbi->begin_work;
|
1104
|
1104
|
$dbi->dbh->{AutoCommit} = 0;
|
1105
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1105
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1106
|
1106
|
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
1107
|
1107
|
$dbi->commit;
|
1108
|
1108
|
$dbi->dbh->{AutoCommit} = 1;
|
...
|
...
|
@@ -1150,9 +1150,9 @@ $dbi->execute($create_table1);
|
1150
|
1150
|
$dbi->begin_work;
|
1151
|
1151
|
|
1152
|
1152
|
eval {
|
1153
|
|
- $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1153
|
+ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1154
|
1154
|
die "Error";
|
1155
|
|
- $dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1155
|
+ $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1156
|
1156
|
};
|
1157
|
1157
|
|
1158
|
1158
|
$dbi->rollback if $@;
|
...
|
...
|
@@ -1164,8 +1164,8 @@ is_deeply($rows, [], "rollback");
|
1164
|
1164
|
$dbi->begin_work;
|
1165
|
1165
|
|
1166
|
1166
|
eval {
|
1167
|
|
- $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1168
|
|
- $dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1167
|
+ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1168
|
+ $dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1169
|
1169
|
};
|
1170
|
1170
|
|
1171
|
1171
|
$dbi->commit unless $@;
|
...
|
...
|
@@ -1192,7 +1192,7 @@ eval { $dbi->execute("drop table $table1") };
|
1192
|
1192
|
$dbi->execute($create_table1);
|
1193
|
1193
|
$dbi->{_cached} = {};
|
1194
|
1194
|
$dbi->cache(0);
|
1195
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1195
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1196
|
1196
|
is(scalar keys %{$dbi->{_cached}}, 0, 'not cache');
|
1197
|
1197
|
|
1198
|
1198
|
test 'execute';
|
...
|
...
|
@@ -1256,7 +1256,7 @@ $dbi->register_filter(three_times => sub { $_[0] * 3});
|
1256
|
1256
|
$dbi->apply_filter(
|
1257
|
1257
|
$table1, $key1 => {out => 'twice', in => 'three_times'},
|
1258
|
1258
|
$key2 => {out => 'three_times', in => 'twice'});
|
1259
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1259
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1260
|
1260
|
$result = $dbi->execute("select * from $table1");
|
1261
|
1261
|
$row = $result->fetch_hash_first;
|
1262
|
1262
|
is_deeply($row, {$key1 => 2, $key2 => 6}, "insert");
|
...
|
...
|
@@ -1275,7 +1275,7 @@ $dbi->apply_filter(
|
1275
|
1275
|
$dbi->apply_filter(
|
1276
|
1276
|
$table1, $key1 => {out => undef}
|
1277
|
1277
|
);
|
1278
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1278
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1279
|
1279
|
$result = $dbi->execute("select * from $table1");
|
1280
|
1280
|
$row = $result->one;
|
1281
|
1281
|
is_deeply($row, {$key1 => 1, $key2 => 6}, "insert");
|
...
|
...
|
@@ -1383,27 +1383,27 @@ test 'connect super';
|
1383
|
1383
|
$dbi = DBIx::Custom->connect;
|
1384
|
1384
|
eval { $dbi->execute("drop table $table1") };
|
1385
|
1385
|
$dbi->execute($create_table1);
|
1386
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1386
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1387
|
1387
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
1388
|
1388
|
|
1389
|
1389
|
$dbi = DBIx::Custom->new;
|
1390
|
1390
|
$dbi->connect;
|
1391
|
1391
|
eval { $dbi->execute("drop table $table1") };
|
1392
|
1392
|
$dbi->execute($create_table1);
|
1393
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1393
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1394
|
1394
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
1395
|
1395
|
|
1396
|
1396
|
$dbi = DBIx::Custom->connect;
|
1397
|
1397
|
eval { $dbi->execute("drop table $table1") };
|
1398
|
1398
|
$dbi->execute($create_table1);
|
1399
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1399
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1400
|
1400
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
1401
|
1401
|
|
1402
|
1402
|
test 'end_filter';
|
1403
|
1403
|
$dbi = DBIx::Custom->connect;
|
1404
|
1404
|
eval { $dbi->execute("drop table $table1") };
|
1405
|
1405
|
$dbi->execute($create_table1);
|
1406
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1406
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1407
|
1407
|
$result = $dbi->select(table => $table1);
|
1408
|
1408
|
$result->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 });
|
1409
|
1409
|
$result->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 });
|
...
|
...
|
@@ -1413,7 +1413,7 @@ is_deeply($row, [6, 40]);
|
1413
|
1413
|
$dbi = DBIx::Custom->connect;
|
1414
|
1414
|
eval { $dbi->execute("drop table $table1") };
|
1415
|
1415
|
$dbi->execute($create_table1);
|
1416
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1416
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1417
|
1417
|
$result = $dbi->select(table => $table1);
|
1418
|
1418
|
$result->filter([$key1, $key2] => sub { $_[0] * 2 });
|
1419
|
1419
|
$result->end_filter([[$key1, $key2] => sub { $_[0] * 3 }]);
|
...
|
...
|
@@ -1423,7 +1423,7 @@ is_deeply($row, [6, 12]);
|
1423
|
1423
|
$dbi = DBIx::Custom->connect;
|
1424
|
1424
|
eval { $dbi->execute("drop table $table1") };
|
1425
|
1425
|
$dbi->execute($create_table1);
|
1426
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1426
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1427
|
1427
|
$result = $dbi->select(table => $table1);
|
1428
|
1428
|
$result->filter([[$key1, $key2] => sub { $_[0] * 2 }]);
|
1429
|
1429
|
$result->end_filter([$key1, $key2] => sub { $_[0] * 3 });
|
...
|
...
|
@@ -1463,7 +1463,7 @@ test 'remove_end_filter and remove_filter';
|
1463
|
1463
|
$dbi = DBIx::Custom->connect;
|
1464
|
1464
|
eval { $dbi->execute("drop table $table1") };
|
1465
|
1465
|
$dbi->execute($create_table1);
|
1466
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1466
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1467
|
1467
|
$result = $dbi->select(table => $table1);
|
1468
|
1468
|
$row = $result
|
1469
|
1469
|
->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 })
|
...
|
...
|
@@ -1477,7 +1477,7 @@ test 'empty where select';
|
1477
|
1477
|
$dbi = DBIx::Custom->connect;
|
1478
|
1478
|
eval { $dbi->execute("drop table $table1") };
|
1479
|
1479
|
$dbi->execute($create_table1);
|
1480
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
1480
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
1481
|
1481
|
$result = $dbi->select(table => $table1, where => {});
|
1482
|
1482
|
$row = $result->one;
|
1483
|
1483
|
is_deeply($row, {$key1 => 1, $key2 => 2});
|
...
|
...
|
@@ -1499,8 +1499,8 @@ test 'where';
|
1499
|
1499
|
$dbi = DBIx::Custom->connect;
|
1500
|
1500
|
eval { $dbi->execute("drop table $table1") };
|
1501
|
1501
|
$dbi->execute($create_table1);
|
1502
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1503
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1502
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1503
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1504
|
1504
|
$where = $dbi->where->clause(['and', "$key1 = :$key1", "$key2 = :$key2"]);
|
1505
|
1505
|
is("$where", "where ( $key1 = :$key1 and $key2 = :$key2 )", 'no param');
|
1506
|
1506
|
|
...
|
...
|
@@ -1838,8 +1838,8 @@ $dbi->apply_filter(
|
1838
|
1838
|
$dbi = DBIx::Custom->connect;
|
1839
|
1839
|
eval { $dbi->execute("drop table $table1") };
|
1840
|
1840
|
$dbi->execute($create_table1);
|
1841
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1842
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1841
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1842
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1843
|
1843
|
$dbi->apply_filter($table1, $key2,
|
1844
|
1844
|
{in => sub { $_[0] * 3 }, out => sub { $_[0] * 2 }});
|
1845
|
1845
|
$rows = $dbi->select(table => $table1, where => {$key2 => 1})->all;
|
...
|
...
|
@@ -1848,8 +1848,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 6}]);
|
1848
|
1848
|
$dbi = DBIx::Custom->connect;
|
1849
|
1849
|
eval { $dbi->execute("drop table $table1") };
|
1850
|
1850
|
$dbi->execute($create_table1);
|
1851
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
1852
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
1851
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
1852
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
1853
|
1853
|
$dbi->apply_filter($table1, $key2, {});
|
1854
|
1854
|
$rows = $dbi->select(table => $table1, where => {$key2 => 2})->all;
|
1855
|
1855
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
|
...
|
...
|
@@ -1946,22 +1946,22 @@ $dbi = DBIx::Custom->connect;
|
1946
|
1946
|
eval { $dbi->execute("drop table $table1") };
|
1947
|
1947
|
$dbi->execute($create_table1_2);
|
1948
|
1948
|
$dbi->insert_at(
|
|
1949
|
+ {$key3 => 3},
|
1949
|
1950
|
primary_key => [$key1, $key2],
|
1950
|
1951
|
table => $table1,
|
1951
|
1952
|
where => [1, 2],
|
1952
|
|
- param => {$key3 => 3}
|
1953
|
1953
|
);
|
1954
|
1954
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
1955
|
1955
|
is($dbi->select(table => $table1)->one->{$key2}, 2);
|
1956
|
1956
|
is($dbi->select(table => $table1)->one->{$key3}, 3);
|
1957
|
1957
|
|
1958
|
1958
|
$dbi->delete_all(table => $table1);
|
1959
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
1959
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
1960
|
1960
|
$dbi->insert_at(
|
|
1961
|
+ {$key2 => 2, $key3 => 3},
|
1961
|
1962
|
primary_key => $key1,
|
1962
|
1963
|
table => $table1,
|
1963
|
1964
|
where => 1,
|
1964
|
|
- param => {$key2 => 2, $key3 => 3}
|
1965
|
1965
|
);
|
1966
|
1966
|
|
1967
|
1967
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
...
|
...
|
@@ -1970,10 +1970,10 @@ is($dbi->select(table => $table1)->one->{$key3}, 3);
|
1970
|
1970
|
|
1971
|
1971
|
eval {
|
1972
|
1972
|
$dbi->insert_at(
|
|
1973
|
+ {$key1 => 1, $key2 => 2, $key3 => 3},
|
1973
|
1974
|
table => $table1,
|
1974
|
1975
|
primary_key => [$key1, $key2],
|
1975
|
1976
|
where => {},
|
1976
|
|
- param => {$key1 => 1, $key2 => 2, $key3 => 3},
|
1977
|
1977
|
);
|
1978
|
1978
|
};
|
1979
|
1979
|
like($@, qr/must be/);
|
...
|
...
|
@@ -1995,24 +1995,24 @@ test 'update_at';
|
1995
|
1995
|
$dbi = DBIx::Custom->connect;
|
1996
|
1996
|
eval { $dbi->execute("drop table $table1") };
|
1997
|
1997
|
$dbi->execute($create_table1_2);
|
1998
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
1998
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
1999
|
1999
|
$dbi->update_at(
|
|
2000
|
+ {$key3 => 4},
|
2000
|
2001
|
table => $table1,
|
2001
|
2002
|
primary_key => [$key1, $key2],
|
2002
|
2003
|
where => [1, 2],
|
2003
|
|
- param => {$key3 => 4}
|
2004
|
2004
|
);
|
2005
|
2005
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
2006
|
2006
|
is($dbi->select(table => $table1)->one->{$key2}, 2);
|
2007
|
2007
|
is($dbi->select(table => $table1)->one->{$key3}, 4);
|
2008
|
2008
|
|
2009
|
2009
|
$dbi->delete_all(table => $table1);
|
2010
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2010
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2011
|
2011
|
$dbi->update_at(
|
|
2012
|
+ {$key3 => 4},
|
2012
|
2013
|
table => $table1,
|
2013
|
2014
|
primary_key => $key1,
|
2014
|
2015
|
where => 1,
|
2015
|
|
- param => {$key3 => 4}
|
2016
|
2016
|
);
|
2017
|
2017
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
2018
|
2018
|
is($dbi->select(table => $table1)->one->{$key2}, 2);
|
...
|
...
|
@@ -2021,7 +2021,7 @@ is($dbi->select(table => $table1)->one->{$key3}, 4);
|
2021
|
2021
|
$dbi = DBIx::Custom->connect;
|
2022
|
2022
|
eval { $dbi->execute("drop table $table1") };
|
2023
|
2023
|
$dbi->execute($create_table1_2);
|
2024
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2024
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2025
|
2025
|
$dbi->update_at(
|
2026
|
2026
|
{$key3 => 4},
|
2027
|
2027
|
table => $table1,
|
...
|
...
|
@@ -2036,7 +2036,7 @@ test 'select_at';
|
2036
|
2036
|
$dbi = DBIx::Custom->connect;
|
2037
|
2037
|
eval { $dbi->execute("drop table $table1") };
|
2038
|
2038
|
$dbi->execute($create_table1_2);
|
2039
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2039
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2040
|
2040
|
$result = $dbi->select_at(
|
2041
|
2041
|
table => $table1,
|
2042
|
2042
|
primary_key => [$key1, $key2],
|
...
|
...
|
@@ -2048,7 +2048,7 @@ is($row->{$key2}, 2);
|
2048
|
2048
|
is($row->{$key3}, 3);
|
2049
|
2049
|
|
2050
|
2050
|
$dbi->delete_all(table => $table1);
|
2051
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2051
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2052
|
2052
|
$result = $dbi->select_at(
|
2053
|
2053
|
table => $table1,
|
2054
|
2054
|
primary_key => $key1,
|
...
|
...
|
@@ -2060,7 +2060,7 @@ is($row->{$key2}, 2);
|
2060
|
2060
|
is($row->{$key3}, 3);
|
2061
|
2061
|
|
2062
|
2062
|
$dbi->delete_all(table => $table1);
|
2063
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2063
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2064
|
2064
|
$result = $dbi->select_at(
|
2065
|
2065
|
table => $table1,
|
2066
|
2066
|
primary_key => [$key1, $key2],
|
...
|
...
|
@@ -2091,10 +2091,10 @@ like($@, qr/same/);
|
2091
|
2091
|
|
2092
|
2092
|
eval {
|
2093
|
2093
|
$result = $dbi->update_at(
|
|
2094
|
+ {$key1 => 1, $key2 => 2},
|
2094
|
2095
|
table => $table1,
|
2095
|
2096
|
primary_key => [$key1, $key2],
|
2096
|
2097
|
where => {},
|
2097
|
|
- param => {$key1 => 1, $key2 => 2},
|
2098
|
2098
|
);
|
2099
|
2099
|
};
|
2100
|
2100
|
like($@, qr/must be/);
|
...
|
...
|
@@ -2116,13 +2116,13 @@ eval { $dbi->execute("drop table $table3") };
|
2116
|
2116
|
$dbi->execute($create_table1_2);
|
2117
|
2117
|
$dbi->execute($create_table2_2);
|
2118
|
2118
|
$dbi->execute($create_table3);
|
2119
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2119
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2120
|
2120
|
$dbi->model($table1)->delete_at(where => [1, 2]);
|
2121
|
2121
|
is_deeply($dbi->select(table => $table1)->all, []);
|
2122
|
|
-$dbi->insert(table => $table2, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2122
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table2);
|
2123
|
2123
|
$dbi->model($table1)->delete_at(where => [1, 2]);
|
2124
|
2124
|
is_deeply($dbi->select(table => $table1)->all, []);
|
2125
|
|
-$dbi->insert(table => $table3, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2125
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table3);
|
2126
|
2126
|
$dbi->model($table3)->delete_at(where => [1, 2]);
|
2127
|
2127
|
is_deeply($dbi->select(table => $table3)->all, []);
|
2128
|
2128
|
|
...
|
...
|
@@ -2131,8 +2131,8 @@ $dbi = MyDBI6->connect;
|
2131
|
2131
|
eval { $dbi->execute("drop table $table1") };
|
2132
|
2132
|
$dbi->execute($create_table1_2);
|
2133
|
2133
|
$dbi->model($table1)->insert_at(
|
|
2134
|
+ {$key3 => 3},
|
2134
|
2135
|
where => [1, 2],
|
2135
|
|
- param => {$key3 => 3}
|
2136
|
2136
|
);
|
2137
|
2137
|
$result = $dbi->model($table1)->select;
|
2138
|
2138
|
$row = $result->one;
|
...
|
...
|
@@ -2144,10 +2144,10 @@ test 'model update_at';
|
2144
|
2144
|
$dbi = MyDBI6->connect;
|
2145
|
2145
|
eval { $dbi->execute("drop table $table1") };
|
2146
|
2146
|
$dbi->execute($create_table1_2);
|
2147
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2147
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2148
|
2148
|
$dbi->model($table1)->update_at(
|
|
2149
|
+ {$key3 => 4},
|
2149
|
2150
|
where => [1, 2],
|
2150
|
|
- param => {$key3 => 4}
|
2151
|
2151
|
);
|
2152
|
2152
|
$result = $dbi->model($table1)->select;
|
2153
|
2153
|
$row = $result->one;
|
...
|
...
|
@@ -2159,7 +2159,7 @@ test 'model select_at';
|
2159
|
2159
|
$dbi = MyDBI6->connect;
|
2160
|
2160
|
eval { $dbi->execute("drop table $table1") };
|
2161
|
2161
|
$dbi->execute($create_table1_2);
|
2162
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3});
|
|
2162
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3}, table => $table1);
|
2163
|
2163
|
$result = $dbi->model($table1)->select_at(where => [1, 2]);
|
2164
|
2164
|
$row = $result->one;
|
2165
|
2165
|
is($row->{$key1}, 1);
|
...
|
...
|
@@ -2176,8 +2176,8 @@ $dbi->execute($create_table1);
|
2176
|
2176
|
$dbi->execute($create_table2);
|
2177
|
2177
|
$dbi->separator('__');
|
2178
|
2178
|
$dbi->setup_model;
|
2179
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2180
|
|
-$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 3});
|
|
2179
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2180
|
+$dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
|
2181
|
2181
|
$model = $dbi->model($table1);
|
2182
|
2182
|
$result = $model->select(
|
2183
|
2183
|
column => [$model->mycolumn, $model->column($table2)],
|
...
|
...
|
@@ -2195,7 +2195,7 @@ $values_clause = $dbi->values_clause($param);
|
2195
|
2195
|
$sql = <<"EOS";
|
2196
|
2196
|
insert into $table1 $values_clause
|
2197
|
2197
|
EOS
|
2198
|
|
-$dbi->execute($sql, param => $param, table => $table1);
|
|
2198
|
+$dbi->execute($sql, $param, table => $table1);
|
2199
|
2199
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
2200
|
2200
|
is($dbi->select(table => $table1)->one->{$key2}, 2);
|
2201
|
2201
|
|
...
|
...
|
@@ -2207,7 +2207,7 @@ $values_clause = $dbi->insert_param($param);
|
2207
|
2207
|
$sql = <<"EOS";
|
2208
|
2208
|
insert into $table1 $values_clause
|
2209
|
2209
|
EOS
|
2210
|
|
-$dbi->execute($sql, param => $param, table => $table1);
|
|
2210
|
+$dbi->execute($sql, $param, table => $table1);
|
2211
|
2211
|
is($dbi->select(table => $table1)->one->{$key1}, 1);
|
2212
|
2212
|
is($dbi->select(table => $table1)->one->{$key2}, 2);
|
2213
|
2213
|
|
...
|
...
|
@@ -2222,8 +2222,8 @@ eval { $dbi->execute("drop table $table2") };
|
2222
|
2222
|
$dbi->execute($create_table1);
|
2223
|
2223
|
$dbi->execute($create_table2);
|
2224
|
2224
|
$dbi->setup_model;
|
2225
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2226
|
|
-$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 3});
|
|
2225
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2226
|
+$dbi->insert({$key1 => 1, $key3 => 3}, table => $table2);
|
2227
|
2227
|
$model = $dbi->model($table1);
|
2228
|
2228
|
$result = $model->select_at(
|
2229
|
2229
|
column => [
|
...
|
...
|
@@ -2290,12 +2290,12 @@ test 'select() param option';
|
2290
|
2290
|
$dbi = DBIx::Custom->connect;
|
2291
|
2291
|
eval { $dbi->execute("drop table $table1") };
|
2292
|
2292
|
$dbi->execute($create_table1);
|
2293
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2294
|
|
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
|
2293
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2294
|
+$dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
|
2295
|
2295
|
eval { $dbi->execute("drop table $table2") };
|
2296
|
2296
|
$dbi->execute($create_table2);
|
2297
|
|
-$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 4});
|
2298
|
|
-$dbi->insert(table => $table2, param => {$key1 => 2, $key3 => 5});
|
|
2297
|
+$dbi->insert({$key1 => 1, $key3 => 4}, table => $table2);
|
|
2298
|
+$dbi->insert({$key1 => 2, $key3 => 5}, table => $table2);
|
2299
|
2299
|
$rows = $dbi->select(
|
2300
|
2300
|
table => $table1,
|
2301
|
2301
|
column => "$table1.$key1 as ${table1}_$key1, $key2, $key3",
|
...
|
...
|
@@ -2320,8 +2320,8 @@ test 'select() string where';
|
2320
|
2320
|
$dbi = DBIx::Custom->connect;
|
2321
|
2321
|
eval { $dbi->execute("drop table $table1") };
|
2322
|
2322
|
$dbi->execute($create_table1);
|
2323
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2324
|
|
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
|
2323
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2324
|
+$dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
|
2325
|
2325
|
$rows = $dbi->select(
|
2326
|
2326
|
table => $table1,
|
2327
|
2327
|
where => "$key1 = :$key1 and $key2 = :$key2",
|
...
|
...
|
@@ -2332,8 +2332,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
|
2332
|
2332
|
$dbi = DBIx::Custom->connect;
|
2333
|
2333
|
eval { $dbi->execute("drop table $table1") };
|
2334
|
2334
|
$dbi->execute($create_table1);
|
2335
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2336
|
|
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
|
2335
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2336
|
+$dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
|
2337
|
2337
|
$rows = $dbi->select(
|
2338
|
2338
|
table => $table1,
|
2339
|
2339
|
where => [
|
...
|
...
|
@@ -2346,8 +2346,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
|
2346
|
2346
|
$dbi = DBIx::Custom->connect;
|
2347
|
2347
|
eval { $dbi->execute("drop table $table1") };
|
2348
|
2348
|
$dbi->execute($create_table1);
|
2349
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2350
|
|
-$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
|
2349
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2350
|
+$dbi->insert({$key1 => 2, $key2 => 3}, table => $table1);
|
2351
|
2351
|
$rows = $dbi->select(
|
2352
|
2352
|
table => $table1,
|
2353
|
2353
|
where => [
|
...
|
...
|
@@ -2361,7 +2361,7 @@ test 'delete() string where';
|
2361
|
2361
|
$dbi = DBIx::Custom->connect;
|
2362
|
2362
|
eval { $dbi->execute("drop table $table1") };
|
2363
|
2363
|
$dbi->execute($create_table1);
|
2364
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2364
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2365
|
2365
|
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
2366
|
2366
|
$dbi->delete(
|
2367
|
2367
|
table => $table1,
|
...
|
...
|
@@ -2374,7 +2374,7 @@ is_deeply($rows, [{$key1 => 2, $key2 => 3}]);
|
2374
|
2374
|
$dbi = DBIx::Custom->connect;
|
2375
|
2375
|
eval { $dbi->execute("drop table $table1") };
|
2376
|
2376
|
$dbi->execute($create_table1);
|
2377
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2377
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2378
|
2378
|
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
2379
|
2379
|
$dbi->delete(
|
2380
|
2380
|
table => $table1,
|
...
|
...
|
@@ -2391,7 +2391,7 @@ test 'update() string where';
|
2391
|
2391
|
$dbi = DBIx::Custom->connect;
|
2392
|
2392
|
eval { $dbi->execute("drop table $table1") };
|
2393
|
2393
|
$dbi->execute($create_table1);
|
2394
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2394
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2395
|
2395
|
$dbi->update(
|
2396
|
2396
|
table => $table1,
|
2397
|
2397
|
param => {$key1 => 5},
|
...
|
...
|
@@ -2404,7 +2404,7 @@ is_deeply($rows, [{$key1 => 5, $key2 => 2}]);
|
2404
|
2404
|
$dbi = DBIx::Custom->connect;
|
2405
|
2405
|
eval { $dbi->execute("drop table $table1") };
|
2406
|
2406
|
$dbi->execute($create_table1);
|
2407
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2407
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2408
|
2408
|
$dbi->update(
|
2409
|
2409
|
table => $table1,
|
2410
|
2410
|
param => {$key1 => 5},
|
...
|
...
|
@@ -2668,7 +2668,7 @@ eval { $dbi->execute("drop table $table2") };
|
2668
|
2668
|
$dbi->execute($create_table1);
|
2669
|
2669
|
$dbi->execute($create_table2);
|
2670
|
2670
|
$dbi->setup_model;
|
2671
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2671
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2672
|
2672
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 3});
|
2673
|
2673
|
$model = $dbi->model($table1);
|
2674
|
2674
|
$result = $model->select(
|
...
|
...
|
@@ -2704,7 +2704,7 @@ $model2 = $dbi->create_model(
|
2704
|
2704
|
table => $table2,
|
2705
|
2705
|
);
|
2706
|
2706
|
$dbi->setup_model;
|
2707
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2707
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2708
|
2708
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 3});
|
2709
|
2709
|
$model = $dbi->model($table1);
|
2710
|
2710
|
$result = $model->select(
|
...
|
...
|
@@ -2761,7 +2761,7 @@ $dbi->create_model(
|
2761
|
2761
|
primary_key => [$key1],
|
2762
|
2762
|
);
|
2763
|
2763
|
$dbi->setup_model;
|
2764
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2764
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2765
|
2765
|
$model = $dbi->model($table1);
|
2766
|
2766
|
$result = $model->select(column => $key1);
|
2767
|
2767
|
$result->filter($key1 => sub { $_[0] * 2 });
|
...
|
...
|
@@ -2776,7 +2776,7 @@ test 'select prefix option';
|
2776
|
2776
|
$dbi = DBIx::Custom->connect;
|
2777
|
2777
|
eval { $dbi->execute("drop table $table1") };
|
2778
|
2778
|
$dbi->execute($create_table1);
|
2779
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
2779
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
2780
|
2780
|
$rows = $dbi->select(prefix => "$key1,", column => $key2, table => $table1)->all;
|
2781
|
2781
|
is_deeply($rows, [{$key1 => 1, $key2 => 2}], "table");
|
2782
|
2782
|
|
...
|
...
|
@@ -2840,8 +2840,8 @@ is_deeply($param, {price => '%a', 'book.author' => 'b'});
|
2840
|
2840
|
|
2841
|
2841
|
eval { $dbi->execute("drop table $table1") };
|
2842
|
2842
|
$dbi->execute($create_table1);
|
2843
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
2844
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
2843
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
2844
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
2845
|
2845
|
|
2846
|
2846
|
$where = $dbi->where;
|
2847
|
2847
|
$where->clause(['and', ":${key1}{=}"]);
|
...
|
...
|
@@ -3039,8 +3039,8 @@ is_deeply([map { lc } @{$result->header}], [qw/h1 h2/]);
|
3039
|
3039
|
test 'Named placeholder :name(operater) syntax';
|
3040
|
3040
|
eval { $dbi->execute("drop table $table1") };
|
3041
|
3041
|
$dbi->execute($create_table1_2);
|
3042
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
3043
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
3042
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
3043
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
3044
|
3044
|
|
3045
|
3045
|
$source = "select * from $table1 where :${key1}{=} and :${key2}{=}";
|
3046
|
3046
|
$result = $dbi->execute($source, param => {$key1 => 1, $key2 => 2});
|
...
|
...
|
@@ -3371,7 +3371,7 @@ $dbi = DBIx::Custom->connect;
|
3371
|
3371
|
$dbi->user_table_info($user_table_info);
|
3372
|
3372
|
eval { $dbi->execute("drop table $table1") };
|
3373
|
3373
|
$dbi->execute($create_table1);
|
3374
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
3374
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
3375
|
3375
|
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
3376
|
3376
|
$rows = $dbi->select(
|
3377
|
3377
|
table => $table1,
|
...
|
...
|
@@ -3389,7 +3389,7 @@ $dbi = DBIx::Custom->connect;
|
3389
|
3389
|
$dbi->user_table_info($user_table_info);
|
3390
|
3390
|
eval { $dbi->execute("drop table $table1") };
|
3391
|
3391
|
$dbi->execute($create_table1);
|
3392
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
3392
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
3393
|
3393
|
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 3});
|
3394
|
3394
|
$rows = $dbi->select(
|
3395
|
3395
|
table => $table1,
|
...
|
...
|
@@ -3476,7 +3476,7 @@ $dbi->create_model(
|
3476
|
3476
|
]
|
3477
|
3477
|
);
|
3478
|
3478
|
$dbi->setup_model;
|
3479
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
3479
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
3480
|
3480
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 3});
|
3481
|
3481
|
$model = $dbi->model($table1);
|
3482
|
3482
|
$result = $model->select(
|
...
|
...
|
@@ -3513,8 +3513,8 @@ test 'assign_clause';
|
3513
|
3513
|
$dbi = DBIx::Custom->connect;
|
3514
|
3514
|
eval { $dbi->execute("drop table $table1") };
|
3515
|
3515
|
$dbi->execute($create_table1_2);
|
3516
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
3517
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
3516
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
3517
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
3518
|
3518
|
|
3519
|
3519
|
$param = {$key2 => 11};
|
3520
|
3520
|
$assign_clause = $dbi->assign_clause($param);
|
...
|
...
|
@@ -3533,8 +3533,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
3533
|
3533
|
$dbi = DBIx::Custom->connect;
|
3534
|
3534
|
eval { $dbi->execute("drop table $table1") };
|
3535
|
3535
|
$dbi->execute($create_table1_2);
|
3536
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
3537
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
3536
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
3537
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
3538
|
3538
|
|
3539
|
3539
|
$param = {$key2 => 11, $key3 => 33};
|
3540
|
3540
|
$assign_clause = $dbi->assign_clause($param);
|
...
|
...
|
@@ -3552,8 +3552,8 @@ is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 33, $key4 => 4, $key5 => 5}
|
3552
|
3552
|
$dbi = DBIx::Custom->connect;
|
3553
|
3553
|
eval { $dbi->execute("drop table $table1") };
|
3554
|
3554
|
$dbi->execute($create_table1_2);
|
3555
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
3556
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
3555
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
3556
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
3557
|
3557
|
|
3558
|
3558
|
$param = {$key2 => 11, $key3 => 33};
|
3559
|
3559
|
$assign_clause = $dbi->update_param($param, {no_set => 1});
|
...
|
...
|
@@ -3575,8 +3575,8 @@ like($@, qr/not safety/);
|
3575
|
3575
|
$dbi = DBIx::Custom->connect;
|
3576
|
3576
|
eval { $dbi->execute("drop table $table1") };
|
3577
|
3577
|
$dbi->execute($create_table1_2);
|
3578
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
3579
|
|
-$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
|
3578
|
+$dbi->insert({$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}, table => $table1);
|
|
3579
|
+$dbi->insert({$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}, table => $table1);
|
3580
|
3580
|
|
3581
|
3581
|
$param = {$key2 => 11};
|
3582
|
3582
|
$assign_clause = $dbi->assign_param($param);
|
...
|
...
|
@@ -4196,8 +4196,8 @@ test 'join';
|
4196
|
4196
|
$dbi = DBIx::Custom->connect;
|
4197
|
4197
|
eval { $dbi->execute("drop table $table1") };
|
4198
|
4198
|
$dbi->execute($create_table1);
|
4199
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
4200
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
4199
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
4200
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
4201
|
4201
|
eval { $dbi->execute("drop table $table2") };
|
4202
|
4202
|
$dbi->execute($create_table2);
|
4203
|
4203
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
...
|
...
|
@@ -4215,8 +4215,8 @@ is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $
|
4215
|
4215
|
$dbi = DBIx::Custom->connect;
|
4216
|
4216
|
eval { $dbi->execute("drop table $table1") };
|
4217
|
4217
|
$dbi->execute($create_table1);
|
4218
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
4219
|
|
-$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
|
4218
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
|
4219
|
+$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
4220
|
4220
|
eval { $dbi->execute("drop table $table2") };
|
4221
|
4221
|
$dbi->execute($create_table2);
|
4222
|
4222
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
...
|
...
|
@@ -4270,7 +4270,7 @@ is_deeply($rows, [{"${table1}__$key1" => 1}]);
|
4270
|
4270
|
$dbi = DBIx::Custom->connect;
|
4271
|
4271
|
eval { $dbi->execute("drop table $table1") };
|
4272
|
4272
|
$dbi->execute($create_table1);
|
4273
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4273
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4274
|
4274
|
eval { $dbi->execute("drop table $table2") };
|
4275
|
4275
|
$dbi->execute($create_table2);
|
4276
|
4276
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
...
|
...
|
@@ -4287,7 +4287,7 @@ is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $
|
4287
|
4287
|
$dbi = DBIx::Custom->connect;
|
4288
|
4288
|
eval { $dbi->execute("drop table $table1") };
|
4289
|
4289
|
$dbi->execute($create_table1);
|
4290
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4290
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4291
|
4291
|
$sql = <<"EOS";
|
4292
|
4292
|
left outer join (
|
4293
|
4293
|
select * from $table1 t1
|
...
|
...
|
@@ -4310,7 +4310,7 @@ eval { $dbi->execute("drop table $table1") };
|
4310
|
4310
|
eval { $dbi->execute("drop table $table2") };
|
4311
|
4311
|
$dbi->execute($create_table1);
|
4312
|
4312
|
$dbi->execute($create_table2);
|
4313
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4313
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4314
|
4314
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 4});
|
4315
|
4315
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
4316
|
4316
|
$result = $dbi->select(
|
...
|
...
|
@@ -4342,7 +4342,7 @@ eval { $dbi->execute("drop table $table1") };
|
4342
|
4342
|
eval { $dbi->execute("drop table $table2") };
|
4343
|
4343
|
$dbi->execute($create_table1);
|
4344
|
4344
|
$dbi->execute($create_table2);
|
4345
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4345
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4346
|
4346
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 4});
|
4347
|
4347
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
4348
|
4348
|
$result = $dbi->select(
|
...
|
...
|
@@ -4362,7 +4362,7 @@ eval { $dbi->execute("drop table $table1") };
|
4362
|
4362
|
eval { $dbi->execute("drop table $table2") };
|
4363
|
4363
|
$dbi->execute($create_table1);
|
4364
|
4364
|
$dbi->execute($create_table2);
|
4365
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4365
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4366
|
4366
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 4});
|
4367
|
4367
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 1});
|
4368
|
4368
|
$result = $dbi->select(
|
...
|
...
|
@@ -4379,7 +4379,7 @@ eval { $dbi->execute("drop table $table1") };
|
4379
|
4379
|
eval { $dbi->execute("drop table $table2") };
|
4380
|
4380
|
$dbi->execute($create_table1);
|
4381
|
4381
|
$dbi->execute($create_table2);
|
4382
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4382
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4383
|
4383
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 4});
|
4384
|
4384
|
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 1});
|
4385
|
4385
|
$result = $dbi->select(
|
...
|
...
|
@@ -4399,7 +4399,7 @@ test 'count';
|
4399
|
4399
|
$dbi = DBIx::Custom->connect;
|
4400
|
4400
|
eval { $dbi->execute("drop table $table1") };
|
4401
|
4401
|
$dbi->execute($create_table1);
|
4402
|
|
-$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
|
4402
|
+$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
4403
|
4403
|
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 3});
|
4404
|
4404
|
is($dbi->count(table => $table1), 2);
|
4405
|
4405
|
is($dbi->count(table => $table1, where => {$key2 => 2}), 1);
|