Rename option nocycle to connect_by_nocycle
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Oracle / Generic.pm
index e926911..9ab80bf 100644 (file)
@@ -44,8 +44,8 @@ DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class
   my $rs = $schema->resultset('Person')->search({},
     {
       'start_with' => { 'firstname' => 'foo', 'lastname' => 'bar' },
-      'connect_by' => { 'parentid' => 'prior persionid'},
-      'order_siblings_by' => 'firstname ASC',
+      'connect_by' => { 'parentid' => { '-prior' => \'persionid' },
+      'order_siblings_by' => { -asc => 'name' },
     };
   );
 
@@ -157,9 +157,10 @@ sub _ping {
   my $dbh = $self->_dbh or return 0;
 
   local $dbh->{RaiseError} = 1;
+  local $dbh->{PrintError} = 0;
 
   eval {
-    $dbh->do("select 1 from dual");
+    $dbh->do('select 1 from dual');
   };
 
   return $@ ? 0 : 1;
@@ -239,10 +240,10 @@ Used as:
 
     on_connect_call => 'datetime_setup'
 
-In L<DBIx::Class::Storage::DBI/connect_info> to set the session nls date, and
-timestamp values for use with L<DBIx::Class::InflateColumn::DateTime> and the
-necessary environment variables for L<DateTime::Format::Oracle>, which is used
-by it.
+In L<connect_info|DBIx::Class::Storage::DBI/connect_info> to set the session nls
+date, and timestamp values for use with L<DBIx::Class::InflateColumn::DateTime>
+and the necessary environment variables for L<DateTime::Format::Oracle>, which
+is used by it.
 
 Maximum allowable precision is used, unless the environment variables have
 already been set.
@@ -416,23 +417,6 @@ sub with_deferred_fk_checks {
     after => sub { $txn_scope_guard->commit });
 }
 
-sub _select_args {
-    my ($self, $ident, $select, $where, $attrs) = @_;
-
-    my $connect_by_args = {};
-    if ( $attrs->{connect_by} || $attrs->{start_with} || $attrs->{order_siblings_by} ) {
-        $connect_by_args = {
-            connect_by => $attrs->{connect_by},
-            start_with => $attrs->{start_with},
-            order_siblings_by => $attrs->{order_siblings_by},
-        }
-    }
-
-    my @rv = $self->next::method($ident, $select, $where, $attrs);
-
-    return (@rv, $connect_by_args);
-}
-
 =head1 ATTRIBUTES
 
 Following additional attributes can be used in resultsets.
@@ -458,6 +442,28 @@ and child rows of the hierarchy.
   # CONNECT BY
   #     parentid = prior persionid
 
+=head2 connect_by_nocycle
+
+=over 4
+
+=item Value: [1|0]
+
+=back
+
+If you want to use NOCYCLE set to 1.
+
+    connect_by => { parentid => 'prior personid' },
+    connect_by_nocycle => 1
+
+    # adds a connect by statement to the query:
+    # SELECT
+    #     me.persionid me.firstname, me.lastname, me.parentid
+    # FROM
+    #     person me
+    # CONNECT BY NOCYCLE
+    #     parentid = prior persionid
+
+
 =head2 start_with
 
 =over 4