Add link to SQLHackers documentation
[dbsrgits/DBIx-Class.git] / t / 73oracle_hq.t
index 07c1f40..af526d9 100644 (file)
@@ -3,7 +3,7 @@ use warnings;
 
 use Test::Exception;
 use Test::More;
-
+use DBIx::Class::Optional::Dependencies ();
 use lib qw(t/lib);
 use DBIC::SqlMakerTest;
 
@@ -15,14 +15,14 @@ $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.'
  unless ($dsn && $user && $pass);
 
+plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('rdbms_oracle')
+  unless DBIx::Class::Optional::Dependencies->req_ok_for ('rdbms_oracle');
+
 use DBICTest::Schema::Artist;
 BEGIN {
   DBICTest::Schema::Artist->add_column('parentid');
@@ -316,7 +316,7 @@ do_creates($dbh);
     my $rs = $schema->resultset('Artist')->search({}, {
       start_with => { name => 'root' },
       connect_by => { parentid => { -prior => { -ident => 'artistid' } } },
-      order_by => { -asc => 'name' },
+      order_by => [ { -asc => 'name' }, {  -desc => 'artistid' } ],
       rows => 2,
     });
 
@@ -329,7 +329,7 @@ do_creates($dbh);
               FROM artist me
             START WITH name = ?
             CONNECT BY parentid = PRIOR artistid
-            ORDER BY name ASC
+            ORDER BY name ASC, artistid DESC
           ) me
         WHERE ROWNUM <= ?
       )',
@@ -352,17 +352,22 @@ do_creates($dbh);
           FROM (
             SELECT artistid
               FROM (
-                SELECT me.artistid
-                  FROM artist me
-                START WITH name = ?
-                CONNECT BY parentid = PRIOR artistid
+                SELECT artistid, ROWNUM rownum__index
+                  FROM (
+                    SELECT me.artistid
+                      FROM artist me
+                    START WITH name = ?
+                    CONNECT BY parentid = PRIOR artistid
+                  ) me
               ) me
-            WHERE ROWNUM <= ?
+            WHERE rownum__index BETWEEN ? AND ?
           ) me
       )',
       [
         [ { 'sqlt_datatype' => 'varchar', 'dbic_colname' => 'name', 'sqlt_size' => 100 }
-            => 'root'], [ $ROWS => 2 ] ,
+            => 'root'],
+        [ $ROWS => 1 ],
+        [ $TOTAL => 2 ],
       ],
     );