12 my $sa = new SQL::Abstract;
15 { child => 'person' },
16 [ { father => 'person' }, { 'father.person_id' => 'child.father_id' }, ],
17 [ { mother => 'person' }, { 'mother.person_id' => 'child.mother_id' } ],
19 my $match = 'person child JOIN person father ON ( father.person_id = '
20 . 'child.father_id ) JOIN person mother ON ( mother.person_id '
21 . '= child.mother_id )'
23 is( $sa->_recurse_from(@j), $match, 'join 1 ok' );
26 { mother => 'person' },
27 [ [ { child => 'person' },
28 [ { father => 'person' },
29 { 'father.person_id' => 'child.father_id' }
32 { 'mother.person_id' => 'child.mother_id' }
35 $match = 'person mother JOIN (person child JOIN person father ON ('
36 . ' father.person_id = child.father_id )) ON ( mother.person_id = '
39 is( $sa->_recurse_from(@j2), $match, 'join 2 ok' );
42 { child => 'person' },
43 [ { father => 'person', -join_type => 'inner' }, { 'father.person_id' => 'child.father_id' }, ],
44 [ { mother => 'person', -join_type => 'inner' }, { 'mother.person_id' => 'child.mother_id' } ],
46 $match = 'person child INNER JOIN person father ON ( father.person_id = '
47 . 'child.father_id ) INNER JOIN person mother ON ( mother.person_id '
48 . '= child.mother_id )'
51 is( $sa->_recurse_from(@j3), $match, 'join 3 (inner join) ok');
54 { mother => 'person' },
55 [ [ { child => 'person', -join_type => 'left' },
56 [ { father => 'person', -join_type => 'right' },
57 { 'father.person_id' => 'child.father_id' }
60 { 'mother.person_id' => 'child.mother_id' }
63 $match = 'person mother LEFT JOIN (person child RIGHT JOIN person father ON ('
64 . ' father.person_id = child.father_id )) ON ( mother.person_id = '
67 is( $sa->_recurse_from(@j4), $match, 'join 4 (nested joins + join types) ok');