... | ... |
@@ -168,36 +168,6 @@ is_deeply($result->stash, {}, 'default'); |
168 | 168 |
$result->stash->{foo} = 1; |
169 | 169 |
is($result->stash->{foo}, 1, 'get and set'); |
170 | 170 |
|
171 |
-test 'filter __ expression'; |
|
172 |
-$dbi = DBIx::Custom->connect; |
|
173 |
-eval { $dbi->execute('drop table company') }; |
|
174 |
-eval { $dbi->execute('drop table location') }; |
|
175 |
-$dbi->execute('create table company (id, name, location_id)'); |
|
176 |
-$dbi->execute('create table location (id, name)'); |
|
177 |
-$dbi->apply_filter('location', |
|
178 |
- name => {in => sub { uc $_[0] } } |
|
179 |
-); |
|
180 |
- |
|
181 |
-$dbi->insert(table => 'company', param => {id => 1, name => 'a', location_id => 2}); |
|
182 |
-$dbi->insert(table => 'location', param => {id => 2, name => 'b'}); |
|
183 |
- |
|
184 |
-$result = $dbi->select( |
|
185 |
- table => ['company', 'location'], relation => {'company.location_id' => 'location.id'}, |
|
186 |
- column => ['location.name as location__name'] |
|
187 |
-); |
|
188 |
-is($result->fetch_first->[0], 'B'); |
|
189 |
- |
|
190 |
-$result = $dbi->select( |
|
191 |
- table => 'company', relation => {'company.location_id' => 'location.id'}, |
|
192 |
- column => ['location.name as location__name'] |
|
193 |
-); |
|
194 |
-is($result->fetch_first->[0], 'B'); |
|
195 |
- |
|
196 |
-$result = $dbi->select( |
|
197 |
- table => 'company', relation => {'company.location_id' => 'location.id'}, |
|
198 |
- column => ['location.name as "location.name"'] |
|
199 |
-); |
|
200 |
-is($result->fetch_first->[0], 'B'); |
|
201 | 171 |
|
202 | 172 |
test 'Model class'; |
203 | 173 |
use MyDBI1; |
... | ... |
@@ -2528,4 +2498,67 @@ $dbi->insert(table => 'table', param => {select => 1}); |
2528 | 2498 |
$dbi->delete(table => 'table', where => {select => 1}); |
2529 | 2499 |
$result = $dbi->execute("select * from ${q}table$p"); |
2530 | 2500 |
$rows = $result->all; |
2531 |
-is_deeply($rows, [], "reserved word"); |
|
2501 |
+is_deeply($rows, [], "reserved word"); |
|
2502 |
+ |
|
2503 |
+ |
|
2504 |
+ |
|
2505 |
+ |
|
2506 |
+ |
|
2507 |
+ |
|
2508 |
+ |
|
2509 |
+ |
|
2510 |
+ |
|
2511 |
+ |
|
2512 |
+ |
|
2513 |
+ |
|
2514 |
+ |
|
2515 |
+ |
|
2516 |
+ |
|
2517 |
+ |
|
2518 |
+ |
|
2519 |
+ |
|
2520 |
+ |
|
2521 |
+ |
|
2522 |
+ |
|
2523 |
+ |
|
2524 |
+ |
|
2525 |
+ |
|
2526 |
+ |
|
2527 |
+ |
|
2528 |
+ |
|
2529 |
+ |
|
2530 |
+ |
|
2531 |
+ |
|
2532 |
+ |
|
2533 |
+ |
|
2534 |
+# DEPRECATED! test |
|
2535 |
+test 'filter __ expression'; |
|
2536 |
+$dbi = DBIx::Custom->connect; |
|
2537 |
+eval { $dbi->execute('drop table company') }; |
|
2538 |
+eval { $dbi->execute('drop table location') }; |
|
2539 |
+$dbi->execute('create table company (id, name, location_id)'); |
|
2540 |
+$dbi->execute('create table location (id, name)'); |
|
2541 |
+$dbi->apply_filter('location', |
|
2542 |
+ name => {in => sub { uc $_[0] } } |
|
2543 |
+); |
|
2544 |
+ |
|
2545 |
+$dbi->insert(table => 'company', param => {id => 1, name => 'a', location_id => 2}); |
|
2546 |
+$dbi->insert(table => 'location', param => {id => 2, name => 'b'}); |
|
2547 |
+ |
|
2548 |
+$result = $dbi->select( |
|
2549 |
+ table => ['company', 'location'], relation => {'company.location_id' => 'location.id'}, |
|
2550 |
+ column => ['location.name as location__name'] |
|
2551 |
+); |
|
2552 |
+is($result->fetch_first->[0], 'B'); |
|
2553 |
+ |
|
2554 |
+$result = $dbi->select( |
|
2555 |
+ table => 'company', relation => {'company.location_id' => 'location.id'}, |
|
2556 |
+ column => ['location.name as location__name'] |
|
2557 |
+); |
|
2558 |
+is($result->fetch_first->[0], 'B'); |
|
2559 |
+ |
|
2560 |
+$result = $dbi->select( |
|
2561 |
+ table => 'company', relation => {'company.location_id' => 'location.id'}, |
|
2562 |
+ column => ['location.name as "location.name"'] |
|
2563 |
+); |
|
2564 |
+is($result->fetch_first->[0], 'B'); |