8 use DBIC::SqlMakerTest;
9 use DBIx::Class::SQLAHacks::Oracle;
14 # Offline test for connect_by
15 # ( without acitve database connection)
19 connect_by => { 'parentid' => { '-prior' => \'artistid' } },
20 stmt => " parentid = PRIOR artistid ",
22 msg => 'Simple: parentid = PRIOR artistid',
25 # TODO: Can't handle this...
26 # connect_by => { 'parentid' => { '!=' => { '-prior' => \'artistid' } } },
27 # connect_by => [ \'parentid', ],
28 # stmt => "parentid != PRIOR artistid ",
30 # msg => 'Simple: parentid != PRIOR artistid',
33 # Excample from http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries003.htm
36 'last_name' => { '!=' => 'King' },
37 '-prior' => [ \'employee_id', \'manager_id' ],
39 stmt => "( last_name != ? AND PRIOR employee_id = manager_id )",
44 '-prior' => [ \'employee_id', \'manager_id' ],
45 '-prior' => [ \'account_mgr_id', \'customer_id' ],
47 stmt => "( PRIOR employee_id = manager_id AND PRIOR account_mgr_id = customer_id )",
52 my $sqla_oracle = DBIx::Class::SQLAHacks::Oracle->new();
53 isa_ok($sqla_oracle, 'DBIx::Class::SQLAHacks::Oracle');
56 my $test_count = ( @handle_tests * 2 ) + 1;
58 for my $case (@handle_tests) {
59 local $Data::Dumper::Terse = 1;
61 my $msg = sprintf("Offline: %s",
62 $case->{msg} || substr($case->{stmt},0,25),
66 ( $stmt, @bind ) = $sqla_oracle->_recurse_where( $case->{connect_by}, 'and' );
67 is_same_sql_bind( $stmt, \@bind, $case->{stmt}, $case->{bind},$msg )
68 || diag "Search term:\n" . Dumper $case->{connect_by};
70 ,sprintf("lives is ok from '%s'",$msg));
78 done_testing( $test_count );