Add startup sanity check of the ::DBI::Replicated method dispatch tables
[dbsrgits/DBIx-Class.git] / t / 73oracle_hq.t
index d79fae3..397a97f 100644 (file)
@@ -11,6 +11,9 @@ $ENV{NLS_SORT} = "BINARY";
 $ENV{NLS_COMP} = "BINARY";
 $ENV{NLS_LANG} = "AMERICAN";
 
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle')
+  unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle');
+
 my ($dsn,  $user,  $pass)  = @ENV{map { "DBICTEST_ORA_${_}" }  qw/DSN USER PASS/};
 
 plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.'
@@ -340,30 +343,37 @@ do_creates($dbh);
   }
 
   # combine a connect_by with group_by and having
+  # add some bindvals to make sure things still work
   {
     my $rs = $schema->resultset('Artist')->search({}, {
-      select => { count => 'rank', -as => 'cnt' },
+      select => \[ 'COUNT(rank) + ?', [ __cbind => 3 ] ],
+      as => 'cnt',
       start_with => { name => 'root' },
       connect_by => { parentid => { -prior => { -ident => 'artistid' } } },
-      group_by => ['rank'],
+      group_by => \[ 'rank + ? ', [ __gbind =>  1] ],
       having => \[ 'count(rank) < ?', [ cnt => 2 ] ],
     });
 
     is_same_sql_bind (
       $rs->as_query,
       '(
-        SELECT COUNT(rank) AS cnt
+        SELECT COUNT(rank) + ?
           FROM artist me
         START WITH name = ?
         CONNECT BY parentid = PRIOR artistid
-        GROUP BY rank HAVING count(rank) < ?
+        GROUP BY( rank + ? ) HAVING count(rank) < ?
       )',
-      [ [ name => 'root' ], [ cnt => 2 ] ],
+      [
+        [ __cbind => 3 ],
+        [ name => 'root' ],
+        [ __gbind => 1 ],
+        [ cnt => 2 ]
+      ],
     );
 
     is_deeply (
       [ $rs->get_column ('cnt')->all ],
-      [1, 1],
+      [4, 4],
       'Group By a Connect By query - correct values'
     );
   }