... | ... |
@@ -152,6 +152,9 @@ sub column { |
152 | 152 |
# Separator |
153 | 153 |
my $separator = $self->separator; |
154 | 154 |
|
155 |
+ # . is replaced |
|
156 |
+ $table =~ s/\./$separator/g; |
|
157 |
+ |
|
155 | 158 |
# Column clause |
156 | 159 |
my @column; |
157 | 160 |
$columns ||= []; |
... | ... |
@@ -1694,7 +1697,6 @@ sub _search_tables { |
1694 | 1697 |
my $c = $self->safety_character; |
1695 | 1698 |
|
1696 | 1699 |
while ($source =~ /((?:[$c]+?\.[$c]+?)|(?:[$c]+?))\.[$c]+/g) { |
1697 |
- $DB::single = 1; |
|
1698 | 1700 |
push @$tables, $1; |
1699 | 1701 |
} |
1700 | 1702 |
return $tables; |
... | ... |
@@ -16,6 +16,13 @@ plan 'no_plan'; |
16 | 16 |
$SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /DEPRECATED/}; |
17 | 17 |
sub test { print "# $_[0]\n" } |
18 | 18 |
|
19 |
+# Dot to under score |
|
20 |
+sub u($) { |
|
21 |
+ my $value = shift; |
|
22 |
+ $value =~ s/\./_/g; |
|
23 |
+ return $value; |
|
24 |
+} |
|
25 |
+ |
|
19 | 26 |
# Constant |
20 | 27 |
my $table1 = $dbi->table1; |
21 | 28 |
my $table2 = $dbi->table2; |
... | ... |
@@ -1321,18 +1328,19 @@ $dbi->insert({$key1 => 1, $key3 => 5}, table => $table2); |
1321 | 1328 |
$DB::single = 1; |
1322 | 1329 |
$rows = $dbi->select( |
1323 | 1330 |
table => [$table1, $table2], |
1324 |
- column => "$table1.$key1 as ${table1}_$key1, $table2.$key1 as ${table2}_$key1, $key2, $key3", |
|
1331 |
+ column => "$table1.$key1 as " . u("${table1}_$key1") |
|
1332 |
+ . ", $table2.$key1 as " . u("${table2}_$key1") . ", $key2, $key3", |
|
1325 | 1333 |
where => {"$table1.$key2" => 2}, |
1326 | 1334 |
relation => {"$table1.$key1" => "$table2.$key1"} |
1327 | 1335 |
)->all; |
1328 |
-is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : exists where"); |
|
1336 |
+is_deeply($rows, [{u"${table1}_$key1" => 1, u"${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : exists where"); |
|
1329 | 1337 |
|
1330 | 1338 |
$rows = $dbi->select( |
1331 | 1339 |
table => [$table1, $table2], |
1332 |
- column => ["$table1.$key1 as ${table1}_$key1", "${table2}.$key1 as ${table2}_$key1", $key2, $key3], |
|
1340 |
+ column => ["$table1.$key1 as " . u("${table1}_$key1") . ", ${table2}.$key1 as " . u("${table2}_$key1"), $key2, $key3], |
|
1333 | 1341 |
relation => {"$table1.$key1" => "$table2.$key1"} |
1334 | 1342 |
)->all; |
1335 |
-is_deeply($rows, [{"${table1}_$key1" => 1, "${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : no exists where"); |
|
1343 |
+is_deeply($rows, [{u"${table1}_$key1" => 1, u"${table2}_$key1" => 1, $key2 => 2, $key3 => 5}], "relation : no exists where"); |
|
1336 | 1344 |
|
1337 | 1345 |
$dbi = DBIx::Custom->connect; |
1338 | 1346 |
eval { $dbi->execute("drop table ${q}table$p") }; |