Showing 2 changed files with 21 additions and 20 deletions
+1 -1
Changes
... ...
@@ -1,5 +1,5 @@
1 1
 0.1703
2
-    - added join new syntax.
2
+    - added EXPERIMENTAL join new syntax.
3 3
 0.1702
4 4
     - removed EXPERIMENTAL status of some methods.
5 5
     - fixed some join bug
+20 -19
lib/DBIx/Custom.pm
... ...
@@ -1309,10 +1309,9 @@ sub _push_join {
1309 1309
     
1310 1310
     # Push join clause
1311 1311
     my $tree = {};
1312
-    my $q = $self->_quote;
1313 1312
     for (my $i = 0; $i < @$join; $i++) {
1314 1313
         
1315
-        # Search table in join clause
1314
+        # Arrange
1316 1315
         my $join_clause;;
1317 1316
         my $option;
1318 1317
         if (ref $join->[$i] eq 'HASH') {
... ...
@@ -1323,34 +1322,35 @@ sub _push_join {
1323 1322
             $join_clause = $join->[$i];
1324 1323
             $option = {};
1325 1324
         };
1326
-        my $j_clause = (split /\s+on\s+/, $join_clause)[-1];
1327
-        $j_clause =~ s/'.+?'//g;
1328
-        my $q_re = quotemeta($q);
1329
-        $j_clause =~ s/$q_re//g;
1330
-        my $c = $self->safety_character;
1331
-        my $join_re = qr/(?:^|\s)($c+)\.$c+\s+=\s+($c+)\.$c+/;
1332
-        
1325
+
1326
+        # Find tables in join clause
1333 1327
         my $table1;
1334 1328
         my $table2;
1335 1329
         if (my $table = $option->{table}) {
1336 1330
             $table1 = $table->[0];
1337 1331
             $table2 = $table->[1];
1338 1332
         }
1339
-        elsif ($j_clause =~ $join_re) {
1340
-            $table1 = $1;
1341
-            $table2 = $2;
1333
+        else {
1334
+            my $q = $self->_quote;
1335
+            my $j_clause = (split /\s+on\s+/, $join_clause)[-1];
1336
+            $j_clause =~ s/'.+?'//g;
1337
+            my $q_re = quotemeta($q);
1338
+            $j_clause =~ s/$q_re//g;
1339
+            my $c = $self->safety_character;
1340
+            my $join_re = qr/(?:^|\s)($c+)\.$c+\s+=\s+($c+)\.$c+/;
1341
+            if ($j_clause =~ $join_re) {
1342
+                $table1 = $1;
1343
+                $table2 = $2;
1344
+            }
1342 1345
         }
1343 1346
         croak qq{join clause must have two table name after "on" keyword. } .
1344 1347
               qq{"$join_clause" is passed }  . _subname
1345 1348
           unless defined $table1 && defined $table2;
1346
-
1347 1349
         croak qq{right side table of "$join_clause" must be unique }
1348 1350
             . _subname
1349 1351
           if exists $tree->{$table2};
1350
-        
1351 1352
         croak qq{Same table "$table1" is specified} . _subname
1352 1353
           if $table1 eq $table2;
1353
-        
1354 1354
         $tree->{$table2}
1355 1355
           = {position => $i, parent => $table1, join => $join_clause};
1356 1356
     }
... ...
@@ -2776,7 +2776,7 @@ the following SQL is created
2776 2776
     where company.name = ?;
2777 2777
 
2778 2778
 You can specify two table by yourself. This is useful when join parser can't parse
2779
-the join clause correctly.
2779
+the join clause correctly. This is EXPERIMENTAL.
2780 2780
 
2781 2781
     $dbi->select(
2782 2782
         table => 'book',
... ...
@@ -2803,7 +2803,7 @@ Same as C<execute> method's C<query> option.
2803 2803
 
2804 2804
 =item C<bind_type>
2805 2805
 
2806
-Same as C<execute> method's C<type> option.
2806
+Same as C<execute> method's C<bind_type> option.
2807 2807
 
2808 2808
 =item C<table>
2809 2809
 
... ...
@@ -2937,7 +2937,7 @@ Same as C<select> method's C<where> option.
2937 2937
 
2938 2938
 =item C<bind_type>
2939 2939
 
2940
-Same as C<execute> method's C<type> option.
2940
+Same as C<execute> method's C<bind_type> option.
2941 2941
 
2942 2942
 =item C<type_rule_off> EXPERIMENTAL
2943 2943
 
... ...
@@ -3031,7 +3031,8 @@ L<DBIx::Custom>
3031 3031
       # will be removed at 2017/1/1
3032 3032
     
3033 3033
     # Others
3034
-    execute("select * from {= title}"); # execute tag parsing functionality
3034
+    execute("select * from {= title}"); # execute method's
3035
+                                        # tag parsing functionality
3035 3036
                                         # will be removed at 2017/1/1
3036 3037
     Query caching # will be removed at 2017/1/1
3037 3038