Showing 2 changed files with 19 additions and 14 deletions
+12 -13
t/common.t
... ...
@@ -58,8 +58,7 @@ my $create_table2 = $dbi->create_table2;
58 58
 my $create_table2_2 = $dbi->create_table2_2;
59 59
 my $create_table3 = $dbi->create_table3;
60 60
 my $create_table_reserved = $dbi->create_table_reserved;
61
-my $q = substr($dbi->quote, 0, 1);
62
-my $p = substr($dbi->quote, 1, 1) || $q;
61
+my ($q, $p) = $dbi->_qp;
63 62
 my $date_typename = $dbi->date_typename;
64 63
 my $datetime_typename = $dbi->datetime_typename;
65 64
 my $date_datatype = $dbi->date_datatype;
... ...
@@ -2615,7 +2614,7 @@ $rows = $dbi->select(
2615 2614
   column => "$table1.$key1 as " . u("${table1}_$key1") . ", $key2, $key3",
2616 2615
   where   => {"$table1.$key2" => 3},
2617 2616
   join  => ["inner join (select * from $table2 where {= $table2.$key3})" . 
2618
-            " \"$table2\" on $table1.$key1 = \"$table2\".$key1"],
2617
+            " $q$table2$p on $table1.$key1 = $q$table2$p.$key1"],
2619 2618
   param => {"$table2.$key3" => 5}
2620 2619
 )->all;
2621 2620
 is_deeply($rows, [{u"${table1}_$key1" => 2, $key2 => 3, $key3 => 5}]);
... ...
@@ -2625,7 +2624,7 @@ $rows = $dbi->select(
2625 2624
   column => "$table1.$key1 as " . u("${table1}_$key1") . ", $key2, $key3",
2626 2625
   where   => {"$table1.$key2" => 3},
2627 2626
   join  => "inner join (select * from $table2 where {= $table2.$key3})" . 
2628
-           " \"$table2\" on $table1.$key1 = \"$table2\".$key1",
2627
+           " $q$table2$p on $table1.$key1 = $q$table2$p.$key1",
2629 2628
   param => {"$table2.$key3" => 5}
2630 2629
 )->all;
2631 2630
 is_deeply($rows, [{u"${table1}_$key1" => 2, $key2 => 3, $key3 => 5}]);
... ...
@@ -3890,32 +3889,32 @@ $dbi->execute("insert into $table2 ($key1, $key3) values (1, 4)");
3890 3889
 $model = $dbi->model($table1);
3891 3890
 $result = $model->select(
3892 3891
   column => [
3893
-    $model->column($table2, {alias => $table2_alias})
3892
+    $model->column($table2, {alias => u$table2_alias})
3894 3893
   ],
3895
-  where => {"$table2_alias.$key3" => 4}
3894
+  where => {u($table2_alias) . ".$key3" => 4}
3896 3895
 );
3897 3896
 is_deeply($result->one, 
3898
-        {"$table2_alias.$key1" => 1, "$table2_alias.$key3" => 4});
3897
+        {u($table2_alias) . ".$key1" => 1, u($table2_alias) . ".$key3" => 4});
3899 3898
 
3900 3899
 $dbi->separator('__');
3901 3900
 $result = $model->select(
3902 3901
   column => [
3903
-    $model->column($table2, {alias => $table2_alias})
3902
+    $model->column($table2, {alias => u$table2_alias})
3904 3903
   ],
3905
-  where => {"$table2_alias.$key3" => 4}
3904
+  where => {u($table2_alias) . ".$key3" => 4}
3906 3905
 );
3907 3906
 is_deeply($result->one, 
3908
-  {"${table2_alias}__$key1" => 1, "${table2_alias}__$key3" => 4});
3907
+  {u(${table2_alias}) . "__$key1" => 1, u(${table2_alias}) . "__$key3" => 4});
3909 3908
 
3910 3909
 $dbi->separator('-');
3911 3910
 $result = $model->select(
3912 3911
   column => [
3913
-      $model->column($table2, {alias => $table2_alias})
3912
+    $model->column($table2, {alias => u$table2_alias})
3914 3913
   ],
3915
-  where => {"$table2_alias.$key3" => 4}
3914
+  where => {u($table2_alias) . ".$key3" => 4}
3916 3915
 );
3917 3916
 is_deeply($result->one, 
3918
-  {"$table2_alias-$key1" => 1, "$table2_alias-$key3" => 4});
3917
+  {u(${table2_alias}) . "-$key1" => 1, u(${table2_alias}) . "-$key3" => 4});
3919 3918
 
3920 3919
 test 'create_model';
3921 3920
 $dbi = DBIx::Custom->connect;
+7 -1
t/common_fullqualified/MyModel8/main/table1.pm
... ...
@@ -1,7 +1,13 @@
1 1
 package MyModel8::main::table1;
2 2
 use MyModel8 -base;
3 3
 
4
-has join => sub { ['left join main.table2 main.table2_alias on main.table1.key1 = main.table2_alias.key1'] };
4
+has join => sub {
5
+   my $self = shift;
6
+   
7
+   my ($q, $p) = $self->_qp;
8
+   
9
+   return ["left join main.table2 main_table2_alias on main.table1.key1 = main_table2_alias.key1"]
10
+};
5 11
 
6 12
 
7 13
 1;