| ... | ... |
@@ -760,7 +760,7 @@ is($dbi->filters->{decode_utf8}->(encode_utf8('あ')),
|
| 760 | 760 |
is($dbi->filters->{encode_utf8}->('あ'),
|
| 761 | 761 |
encode_utf8('あ'), "encode_utf8");
|
| 762 | 762 |
|
| 763 |
-test 'transaction'; |
|
| 763 |
+test 'transaction1'; |
|
| 764 | 764 |
$dbi = DBIx::Custom->connect; |
| 765 | 765 |
eval { $dbi->execute('drop table table1') };
|
| 766 | 766 |
$dbi->execute($create_table1); |
| ... | ... |
@@ -782,22 +782,6 @@ $dbi->dbh->rollback; |
| 782 | 782 |
$result = $dbi->select(table => 'table1'); |
| 783 | 783 |
ok(! $result->fetch_first, "rollback"); |
| 784 | 784 |
|
| 785 |
-test 'cache'; |
|
| 786 |
-eval { $dbi->execute('drop table table1') };
|
|
| 787 |
-$dbi->cache(1); |
|
| 788 |
-$dbi->execute($create_table1); |
|
| 789 |
-$source = 'select * from table1 where key1 = :key1 and key2 = :key2;'; |
|
| 790 |
-$dbi->execute($source, {}, query => 1);
|
|
| 791 |
-is_deeply($dbi->{_cached}->{$source},
|
|
| 792 |
- {sql => "select * from table1 where key1 = ? and key2 = ?;", columns => ['key1', 'key2'], tables => []}, "cache");
|
|
| 793 |
- |
|
| 794 |
-eval { $dbi->execute('drop table table1') };
|
|
| 795 |
-$dbi->execute($create_table1); |
|
| 796 |
-$dbi->{_cached} = {};
|
|
| 797 |
-$dbi->cache(0); |
|
| 798 |
-$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
|
| 799 |
-is(scalar keys %{$dbi->{_cached}}, 0, 'not cache');
|
|
| 800 |
- |
|
| 801 | 785 |
test 'execute'; |
| 802 | 786 |
eval { $dbi->execute('drop table table1') };
|
| 803 | 787 |
$dbi->execute($create_table1); |
| ... | ... |
@@ -833,7 +817,7 @@ ok($@, "execute fail"); |
| 833 | 817 |
} |
| 834 | 818 |
|
| 835 | 819 |
|
| 836 |
-test 'transaction'; |
|
| 820 |
+test 'transaction2'; |
|
| 837 | 821 |
$dbi = DBIx::Custom->connect; |
| 838 | 822 |
eval { $dbi->execute('drop table table1') };
|
| 839 | 823 |
$dbi->execute($create_table1); |
| ... | ... |
@@ -920,45 +904,6 @@ ok($@, "execute fail"); |
| 920 | 904 |
like($@, qr/QueryBuilder.*\.t /s, "caller spec : not vebose"); |
| 921 | 905 |
} |
| 922 | 906 |
|
| 923 |
- |
|
| 924 |
-test 'transaction'; |
|
| 925 |
-$dbi = DBIx::Custom->connect; |
|
| 926 |
-eval { $dbi->execute('drop table table1') };
|
|
| 927 |
-$dbi->execute($create_table1); |
|
| 928 |
- |
|
| 929 |
-$dbi->begin_work; |
|
| 930 |
- |
|
| 931 |
-eval {
|
|
| 932 |
- $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
|
| 933 |
- die "Error"; |
|
| 934 |
- $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
|
|
| 935 |
-}; |
|
| 936 |
- |
|
| 937 |
-$dbi->rollback if $@; |
|
| 938 |
- |
|
| 939 |
-$result = $dbi->select(table => 'table1'); |
|
| 940 |
-$rows = $result->all; |
|
| 941 |
-is_deeply($rows, [], "rollback"); |
|
| 942 |
- |
|
| 943 |
-$dbi->begin_work; |
|
| 944 |
- |
|
| 945 |
-eval {
|
|
| 946 |
- $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
|
| 947 |
- $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
|
|
| 948 |
-}; |
|
| 949 |
- |
|
| 950 |
-$dbi->commit unless $@; |
|
| 951 |
- |
|
| 952 |
-$result = $dbi->select(table => 'table1'); |
|
| 953 |
-$rows = $result->all; |
|
| 954 |
-is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "commit");
|
|
| 955 |
- |
|
| 956 |
-$dbi->dbh->{AutoCommit} = 0;
|
|
| 957 |
-eval{ $dbi->begin_work };
|
|
| 958 |
-ok($@, "exception"); |
|
| 959 |
-$dbi->dbh->{AutoCommit} = 1;
|
|
| 960 |
- |
|
| 961 |
- |
|
| 962 | 907 |
test 'method'; |
| 963 | 908 |
$dbi->method( |
| 964 | 909 |
one => sub { 1 }
|
| ... | ... |
@@ -1063,7 +1063,6 @@ is_deeply($result->one, |
| 1063 | 1063 |
is_deeply($model2->select->one, {key1 => 1, key3 => 3});
|
| 1064 | 1064 |
|
| 1065 | 1065 |
test 'model method'; |
| 1066 |
-test 'create_model'; |
|
| 1067 | 1066 |
$dbi = DBIx::Custom->connect; |
| 1068 | 1067 |
eval { $dbi->execute('drop table table2') };
|
| 1069 | 1068 |
$dbi->execute($create_table2); |