Oracle: fix LOB conversions for non-LOBs (RT#69548)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Oracle / Generic.pm
1 package DBIx::Class::Storage::DBI::Oracle::Generic;
2
3 use strict;
4 use warnings;
5 use base qw/DBIx::Class::Storage::DBI/;
6 use mro 'c3';
7 use DBIx::Class::Carp;
8 use Scope::Guard ();
9 use Context::Preserve 'preserve_context';
10 use Try::Tiny;
11 use List::Util 'first';
12 use namespace::clean;
13
14 __PACKAGE__->sql_limit_dialect ('RowNum');
15 __PACKAGE__->sql_quote_char ('"');
16 __PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::Oracle');
17 __PACKAGE__->datetime_parser_type('DateTime::Format::Oracle');
18
19 sub __cache_queries_with_max_lob_parts { 2 }
20
21 =head1 NAME
22
23 DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class
24
25 =head1 SYNOPSIS
26
27   # In your result (table) classes
28   use base 'DBIx::Class::Core';
29   __PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } });
30   __PACKAGE__->set_primary_key('id');
31
32   # Somewhere in your Code
33   # add some data to a table with a hierarchical relationship
34   $schema->resultset('Person')->create ({
35         firstname => 'foo',
36         lastname => 'bar',
37         children => [
38             {
39                 firstname => 'child1',
40                 lastname => 'bar',
41                 children => [
42                     {
43                         firstname => 'grandchild',
44                         lastname => 'bar',
45                     }
46                 ],
47             },
48             {
49                 firstname => 'child2',
50                 lastname => 'bar',
51             },
52         ],
53     });
54
55   # select from the hierarchical relationship
56   my $rs = $schema->resultset('Person')->search({},
57     {
58       'start_with' => { 'firstname' => 'foo', 'lastname' => 'bar' },
59       'connect_by' => { 'parentid' => { '-prior' => { -ident => 'personid' } },
60       'order_siblings_by' => { -asc => 'name' },
61     };
62   );
63
64   # this will select the whole tree starting from person "foo bar", creating
65   # following query:
66   # SELECT
67   #     me.persionid me.firstname, me.lastname, me.parentid
68   # FROM
69   #     person me
70   # START WITH
71   #     firstname = 'foo' and lastname = 'bar'
72   # CONNECT BY
73   #     parentid = prior personid
74   # ORDER SIBLINGS BY
75   #     firstname ASC
76
77 =head1 DESCRIPTION
78
79 This class implements base Oracle support. The subclass
80 L<DBIx::Class::Storage::DBI::Oracle::WhereJoins> is for C<(+)> joins in Oracle
81 versions before 9.0.
82
83 =head1 METHODS
84
85 =cut
86
87 sub _determine_supports_insert_returning {
88   my $self = shift;
89
90 # TODO find out which version supports the RETURNING syntax
91 # 8i has it and earlier docs are a 404 on oracle.com
92
93   return 1
94     if $self->_server_info->{normalized_dbms_version} >= 8.001;
95
96   return 0;
97 }
98
99 __PACKAGE__->_use_insert_returning_bound (1);
100
101 sub deployment_statements {
102   my $self = shift;;
103   my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
104
105   $sqltargs ||= {};
106   my $quote_char = $self->schema->storage->sql_maker->quote_char;
107   $sqltargs->{quote_table_names} = $quote_char ? 1 : 0;
108   $sqltargs->{quote_field_names} = $quote_char ? 1 : 0;
109
110   if (
111     ! exists $sqltargs->{producer_args}{oracle_version}
112       and
113     my $dver = $self->_server_info->{dbms_version}
114   ) {
115     $sqltargs->{producer_args}{oracle_version} = $dver;
116   }
117
118   $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
119 }
120
121 sub _dbh_last_insert_id {
122   my ($self, $dbh, $source, @columns) = @_;
123   my @ids = ();
124   foreach my $col (@columns) {
125     my $seq = ($source->column_info($col)->{sequence} ||= $self->get_autoinc_seq($source,$col));
126     my $id = $self->_sequence_fetch( 'CURRVAL', $seq );
127     push @ids, $id;
128   }
129   return @ids;
130 }
131
132 sub _dbh_get_autoinc_seq {
133   my ($self, $dbh, $source, $col) = @_;
134
135   my $sql_maker = $self->sql_maker;
136   my ($ql, $qr) = map { $_ ? (quotemeta $_) : '' } $sql_maker->_quote_chars;
137
138   my $source_name;
139   if ( ref $source->name eq 'SCALAR' ) {
140     $source_name = ${$source->name};
141
142     # the ALL_TRIGGERS match further on is case sensitive - thus uppercase
143     # stuff unless it is already quoted
144     $source_name = uc ($source_name) if $source_name !~ /\"/;
145   }
146   else {
147     $source_name = $source->name;
148     $source_name = uc($source_name) unless $ql;
149   }
150
151   # trigger_body is a LONG
152   local $dbh->{LongReadLen} = 64 * 1024 if ($dbh->{LongReadLen} < 64 * 1024);
153
154   # disable default bindtype
155   local $sql_maker->{bindtype} = 'normal';
156
157   # look up the correct sequence automatically
158   my ( $schema, $table ) = $source_name =~ /( (?:${ql})? \w+ (?:${qr})? ) \. ( (?:${ql})? \w+ (?:${qr})? )/x;
159
160   # if no explicit schema was requested - use the default schema (which in the case of Oracle is the db user)
161   $schema ||= \'= USER';
162
163   my ($sql, @bind) = $sql_maker->select (
164     'ALL_TRIGGERS',
165     [qw/TRIGGER_BODY TABLE_OWNER TRIGGER_NAME/],
166     {
167       OWNER => $schema,
168       TABLE_NAME => $table || $source_name,
169       TRIGGERING_EVENT => { -like => '%INSERT%' },  # this will also catch insert_or_update
170       TRIGGER_TYPE => { -like => '%BEFORE%' },      # we care only about 'before' triggers
171       STATUS => 'ENABLED',
172      },
173   );
174
175   # to find all the triggers that mention the column in question a simple
176   # regex grep since the trigger_body above is a LONG and hence not searchable
177   # via -like
178   my @triggers = ( map
179     { my %inf; @inf{qw/body schema name/} = @$_; \%inf }
180     ( grep
181       { $_->[0] =~ /\:new\.${ql}${col}${qr} | \:new\.$col/xi }
182       @{ $dbh->selectall_arrayref( $sql, {}, @bind ) }
183     )
184   );
185
186   # extract all sequence names mentioned in each trigger, throw away
187   # triggers without apparent sequences
188   @triggers = map {
189     my @seqs = $_->{body} =~ / ( [\.\w\"\-]+ ) \. nextval /xig;
190     @seqs
191       ? { %$_, sequences => \@seqs }
192       : ()
193     ;
194   } @triggers;
195
196   my $chosen_trigger;
197
198   # if only one trigger matched things are easy
199   if (@triggers == 1) {
200
201     if ( @{$triggers[0]{sequences}} == 1 ) {
202       $chosen_trigger = $triggers[0];
203     }
204     else {
205       $self->throw_exception( sprintf (
206         "Unable to introspect trigger '%s' for column %s.%s (references multiple sequences). "
207       . "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
208         $triggers[0]{name},
209         $source_name,
210         $col,
211         $col,
212       ) );
213     }
214   }
215   # got more than one matching trigger - see if we can narrow it down
216   elsif (@triggers > 1) {
217
218     my @candidates = grep
219       { $_->{body} =~ / into \s+ \:new\.$col /xi }
220       @triggers
221     ;
222
223     if (@candidates == 1 && @{$candidates[0]{sequences}} == 1) {
224       $chosen_trigger = $candidates[0];
225     }
226     else {
227       $self->throw_exception( sprintf (
228         "Unable to reliably select a BEFORE INSERT trigger for column %s.%s (possibilities: %s). "
229       . "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
230         $source_name,
231         $col,
232         ( join ', ', map { "'$_->{name}'" } @triggers ),
233         $col,
234       ) );
235     }
236   }
237
238   if ($chosen_trigger) {
239     my $seq_name = $chosen_trigger->{sequences}[0];
240
241     $seq_name = "$chosen_trigger->{schema}.$seq_name"
242       unless $seq_name =~ /\./;
243
244     return \$seq_name if $seq_name =~ /\"/; # may already be quoted in-trigger
245     return $seq_name;
246   }
247
248   $self->throw_exception( sprintf (
249     "No suitable BEFORE INSERT triggers found for column %s.%s. "
250   . "You need to specify the correct 'sequence' explicitly in '%s's column_info.",
251     $source_name,
252     $col,
253     $col,
254   ));
255 }
256
257 sub _sequence_fetch {
258   my ( $self, $type, $seq ) = @_;
259
260   # use the maker to leverage quoting settings
261   my $sth = $self->_dbh->prepare_cached(
262     $self->sql_maker->select('DUAL', [ ref $seq ? \"$$seq.$type" : "$seq.$type" ] )
263   );
264   $sth->execute;
265   my ($id) = $sth->fetchrow_array;
266   $sth->finish;
267   return $id;
268 }
269
270 sub _ping {
271   my $self = shift;
272
273   my $dbh = $self->_dbh or return 0;
274
275   local $dbh->{RaiseError} = 1;
276   local $dbh->{PrintError} = 0;
277
278   return try {
279     $dbh->do('select 1 from dual');
280     1;
281   } catch {
282     0;
283   };
284 }
285
286 sub _dbh_execute {
287   my ($self, $dbh, $sql, @args) = @_;
288
289   my (@res, $tried);
290   my $want = wantarray;
291   my $next = $self->next::can;
292   do {
293     try {
294       my $exec = sub {
295         # Turn off sth caching for multi-part LOBs. See _prep_for_execute above.
296         local $self->{disable_sth_caching} = 1
297           if first {
298             ($_->[0]{_ora_lob_autosplit_part}||0)
299               > (__cache_queries_with_max_lob_parts-1)
300           } @{ $args[0] };
301
302         $self->$next($dbh, $sql, @args)
303       };
304
305       if (!defined $want) {
306         $exec->();
307       }
308       elsif (! $want) {
309         $res[0] = $exec->();
310       }
311       else {
312         @res = $exec->();
313       }
314
315       $tried++;
316     }
317     catch {
318       if (! $tried and $_ =~ /ORA-01003/) {
319         # ORA-01003: no statement parsed (someone changed the table somehow,
320         # invalidating your cursor.)
321         delete $dbh->{CachedKids}{$sql};
322       }
323       else {
324         $self->throw_exception($_);
325       }
326     };
327   } while (! $tried++);
328
329   return wantarray ? @res : $res[0];
330 }
331
332 sub _dbh_execute_array {
333   #my ($self, $sth, $tuple_status, @extra) = @_;
334
335   # DBD::Oracle warns loudly on partial execute_array failures
336   local $_[1]->{PrintWarn} = 0;
337
338   shift->next::method(@_);
339 }
340
341 =head2 get_autoinc_seq
342
343 Returns the sequence name for an autoincrement column
344
345 =cut
346
347 sub get_autoinc_seq {
348   my ($self, $source, $col) = @_;
349
350   $self->dbh_do('_dbh_get_autoinc_seq', $source, $col);
351 }
352
353 =head2 datetime_parser_type
354
355 This sets the proper DateTime::Format module for use with
356 L<DBIx::Class::InflateColumn::DateTime>.
357
358 =head2 connect_call_datetime_setup
359
360 Used as:
361
362     on_connect_call => 'datetime_setup'
363
364 In L<connect_info|DBIx::Class::Storage::DBI/connect_info> to set the session nls
365 date, and timestamp values for use with L<DBIx::Class::InflateColumn::DateTime>
366 and the necessary environment variables for L<DateTime::Format::Oracle>, which
367 is used by it.
368
369 Maximum allowable precision is used, unless the environment variables have
370 already been set.
371
372 These are the defaults used:
373
374   $ENV{NLS_DATE_FORMAT}         ||= 'YYYY-MM-DD HH24:MI:SS';
375   $ENV{NLS_TIMESTAMP_FORMAT}    ||= 'YYYY-MM-DD HH24:MI:SS.FF';
376   $ENV{NLS_TIMESTAMP_TZ_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM';
377
378 To get more than second precision with L<DBIx::Class::InflateColumn::DateTime>
379 for your timestamps, use something like this:
380
381   use Time::HiRes 'time';
382   my $ts = DateTime->from_epoch(epoch => time);
383
384 =cut
385
386 sub connect_call_datetime_setup {
387   my $self = shift;
388
389   my $date_format = $ENV{NLS_DATE_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS';
390   my $timestamp_format = $ENV{NLS_TIMESTAMP_FORMAT} ||=
391     'YYYY-MM-DD HH24:MI:SS.FF';
392   my $timestamp_tz_format = $ENV{NLS_TIMESTAMP_TZ_FORMAT} ||=
393     'YYYY-MM-DD HH24:MI:SS.FF TZHTZM';
394
395   $self->_do_query(
396     "alter session set nls_date_format = '$date_format'"
397   );
398   $self->_do_query(
399     "alter session set nls_timestamp_format = '$timestamp_format'"
400   );
401   $self->_do_query(
402     "alter session set nls_timestamp_tz_format='$timestamp_tz_format'"
403   );
404 }
405
406 ### Note originally by Ron "Quinn" Straight <quinnfazigu@gmail.org>
407 ### http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=commitdiff;h=5db2758de644d53e07cd3e05f0e9037bf40116fc
408 #
409 # Handle LOB types in Oracle.  Under a certain size (4k?), you can get away
410 # with the driver assuming your input is the deprecated LONG type if you
411 # encode it as a hex string.  That ain't gonna fly at larger values, where
412 # you'll discover you have to do what this does.
413 #
414 # This method had to be overridden because we need to set ora_field to the
415 # actual column, and that isn't passed to the call (provided by Storage) to
416 # bind_attribute_by_data_type.
417 #
418 # According to L<DBD::Oracle>, the ora_field isn't always necessary, but
419 # adding it doesn't hurt, and will save your bacon if you're modifying a
420 # table with more than one LOB column.
421 #
422 sub _dbi_attrs_for_bind {
423   my ($self, $ident, $bind) = @_;
424
425   my $attrs = $self->next::method($ident, $bind);
426
427   for my $i (0 .. $#$attrs) {
428     if (keys %{$attrs->[$i]||{}} and my $col = $bind->[$i][0]{dbic_colname}) {
429       $attrs->[$i]{ora_field} = $col;
430     }
431   }
432
433   $attrs;
434 }
435
436 my $dbd_loaded;
437 sub bind_attribute_by_data_type {
438   my ($self, $dt) = @_;
439
440   $dbd_loaded ||= do {
441     require DBD::Oracle;
442     if ($DBD::Oracle::VERSION eq '1.23') {
443       $self->throw_exception(
444         "BLOB/CLOB support in DBD::Oracle == 1.23 is broken, use an earlier or later ".
445         "version.\n\nSee: https://rt.cpan.org/Public/Bug/Display.html?id=46016\n"
446       );
447     }
448     1;
449   };
450
451   if ($self->_is_lob_type($dt)) {
452     return {
453       ora_type => $self->_is_text_lob_type($dt)
454         ? DBD::Oracle::ORA_CLOB()
455         : DBD::Oracle::ORA_BLOB()
456     };
457   }
458 }
459
460 # Handle blob columns in WHERE.
461 #
462 # For equality comparisons:
463 #
464 # We split data intended for comparing to a LOB into 2000 character chunks and
465 # compare them using dbms_lob.substr on the LOB column.
466 #
467 # We turn off DBD::Oracle LOB binds for these partial LOB comparisons by passing
468 # dbd_attrs => undef, because these are regular varchar2 comparisons and
469 # otherwise the query will fail.
470 #
471 # Since the most common comparison size is likely to be under 4000 characters
472 # (TEXT comparisons previously deployed to other RDBMSes) we disable
473 # prepare_cached for queries with more than two part comparisons to a LOB
474 # column. This is done in _dbh_execute (above) which was previously overridden
475 # to gracefully recover from an Oracle error. This is to be careful to not
476 # exhaust your application's open cursor limit.
477 #
478 # See:
479 # http://itcareershift.com/blog1/2011/02/21/oracle-max-number-of-open-cursors-complete-reference-for-the-new-oracle-dba/
480 # on the open_cursor limit.
481 #
482 # For everything else:
483 #
484 # We assume that everything that is not a LOB comparison, will most likely be a
485 # LIKE query or some sort of function invocation. This may prove to be a naive
486 # assumption in the future, but for now it should cover the two most likely
487 # things users would want to do with a BLOB or CLOB, an equality test or a LIKE
488 # query (on a CLOB.)
489 #
490 # For these expressions, the bind must NOT have the attributes of a LOB bind for
491 # DBD::Oracle, otherwise the query will fail. This is done by passing
492 # dbd_attrs => undef.
493
494 sub _prep_for_execute {
495   my $self = shift;
496   my ($op) = @_;
497
498   return $self->next::method(@_)
499     if $op eq 'insert';
500
501   my ($sql, $bind) = $self->next::method(@_);
502
503   my $lob_bind_indices = { map {
504     (
505       $bind->[$_][0]{sqlt_datatype}
506         and
507       $self->_is_lob_type($bind->[$_][0]{sqlt_datatype})
508     ) ? ( $_ => 1 ) : ()
509   } ( 0 .. $#$bind ) };
510
511   return ($sql, $bind) unless %$lob_bind_indices;
512
513   my ($final_sql, @final_binds);
514   if ($op eq 'update') {
515     $self->throw_exception('Update with complex WHERE clauses currently not supported')
516       if $sql =~ /\bWHERE\b .+ \bWHERE\b/xs;
517
518     ($final_sql, $sql) = $sql =~ /^ (.+?) ( \bWHERE\b .+) /xs;
519
520     if (my $set_bind_count = $final_sql =~ y/?//) {
521
522       delete $lob_bind_indices->{$_} for (0 .. ($set_bind_count - 1));
523
524       # bail if only the update part contains blobs
525       return ($sql, $bind) unless %$lob_bind_indices;
526
527       @final_binds = splice @$bind, 0, $set_bind_count;
528       $lob_bind_indices = { map
529         { $_ - $set_bind_count => $lob_bind_indices->{$_} }
530         keys %$lob_bind_indices
531       };
532     }
533   }
534   elsif ($op ne 'select' and $op ne 'delete') {
535     $self->throw_exception("Unsupported \$op: $op");
536   }
537
538   my @sql_parts = split /\?/, $sql;
539
540   my $col_equality_re = qr/ (?<=\s) ([\w."]+) (\s*=\s*) $/x;
541
542   for my $b_idx (0 .. $#$bind) {
543     my $bound = $bind->[$b_idx];
544
545     if (
546       $lob_bind_indices->{$b_idx}
547         and
548       my ($col, $eq) = $sql_parts[0] =~ $col_equality_re
549     ) {
550       my $data = $bound->[1];
551
552       $data = "$data" if ref $data;
553
554       my @parts = unpack '(a2000)*', $data;
555
556       my @sql_frag;
557
558       for my $idx (0..$#parts) {
559         push @sql_frag, sprintf (
560           'UTL_RAW.CAST_TO_VARCHAR2(RAWTOHEX(DBMS_LOB.SUBSTR(%s, 2000, %d))) = ?',
561           $col, ($idx*2000 + 1),
562         );
563       }
564
565       my $sql_frag = '( ' . (join ' AND ', @sql_frag) . ' )';
566
567       $sql_parts[0] =~ s/$col_equality_re/$sql_frag/;
568
569       $final_sql .= shift @sql_parts;
570
571       for my $idx (0..$#parts) {
572         push @final_binds, [
573           {
574             %{ $bound->[0] },
575             _ora_lob_autosplit_part => $idx,
576             dbd_attrs => undef,
577           },
578           $parts[$idx]
579         ];
580       }
581     }
582     else {
583       $final_sql .= shift(@sql_parts) . '?';
584       push @final_binds, $lob_bind_indices->{$b_idx}
585         ? [
586           {
587             %{ $bound->[0] },
588             dbd_attrs => undef,
589           },
590           $bound->[1],
591         ] : $bound
592       ;
593     }
594   }
595
596   if (@sql_parts > 1) {
597     carp "There are more placeholders than binds, this should not happen!";
598     @sql_parts = join ('?', @sql_parts);
599   }
600
601   $final_sql .= $sql_parts[0];
602
603   return ($final_sql, \@final_binds);
604 }
605
606 # Savepoints stuff.
607
608 sub _exec_svp_begin {
609   my ($self, $name) = @_;
610   $self->_dbh->do("SAVEPOINT $name");
611 }
612
613 # Oracle automatically releases a savepoint when you start another one with the
614 # same name.
615 sub _exec_svp_release { 1 }
616
617 sub _exec_svp_rollback {
618   my ($self, $name) = @_;
619   $self->_dbh->do("ROLLBACK TO SAVEPOINT $name")
620 }
621
622 =head2 relname_to_table_alias
623
624 L<DBIx::Class> uses L<DBIx::Class::Relationship> names as table aliases in
625 queries.
626
627 Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so
628 the L<DBIx::Class::Relationship> name is shortened and appended with half of an
629 MD5 hash.
630
631 See L<DBIx::Class::Storage/"relname_to_table_alias">.
632
633 =cut
634
635 sub relname_to_table_alias {
636   my $self = shift;
637   my ($relname, $join_count) = @_;
638
639   my $alias = $self->next::method(@_);
640
641   # we need to shorten here in addition to the shortening in SQLA itself,
642   # since the final relnames are a crucial for the join optimizer
643   return $self->sql_maker->_shorten_identifier($alias);
644 }
645
646 =head2 with_deferred_fk_checks
647
648 Runs a coderef between:
649
650   alter session set constraints = deferred
651   ...
652   alter session set constraints = immediate
653
654 to defer foreign key checks.
655
656 Constraints must be declared C<DEFERRABLE> for this to work.
657
658 =cut
659
660 sub with_deferred_fk_checks {
661   my ($self, $sub) = @_;
662
663   my $txn_scope_guard = $self->txn_scope_guard;
664
665   $self->_do_query('alter session set constraints = deferred');
666
667   my $sg = Scope::Guard->new(sub {
668     $self->_do_query('alter session set constraints = immediate');
669   });
670
671   return
672     preserve_context { $sub->() } after => sub { $txn_scope_guard->commit };
673 }
674
675 =head1 ATTRIBUTES
676
677 Following additional attributes can be used in resultsets.
678
679 =head2 connect_by or connect_by_nocycle
680
681 =over 4
682
683 =item Value: \%connect_by
684
685 =back
686
687 A hashref of conditions used to specify the relationship between parent rows
688 and child rows of the hierarchy.
689
690
691   connect_by => { parentid => 'prior personid' }
692
693   # adds a connect by statement to the query:
694   # SELECT
695   #     me.persionid me.firstname, me.lastname, me.parentid
696   # FROM
697   #     person me
698   # CONNECT BY
699   #     parentid = prior persionid
700   
701
702   connect_by_nocycle => { parentid => 'prior personid' }
703
704   # adds a connect by statement to the query:
705   # SELECT
706   #     me.persionid me.firstname, me.lastname, me.parentid
707   # FROM
708   #     person me
709   # CONNECT BY NOCYCLE
710   #     parentid = prior persionid
711
712
713 =head2 start_with
714
715 =over 4
716
717 =item Value: \%condition
718
719 =back
720
721 A hashref of conditions which specify the root row(s) of the hierarchy.
722
723 It uses the same syntax as L<DBIx::Class::ResultSet/search>
724
725   start_with => { firstname => 'Foo', lastname => 'Bar' }
726
727   # SELECT
728   #     me.persionid me.firstname, me.lastname, me.parentid
729   # FROM
730   #     person me
731   # START WITH
732   #     firstname = 'foo' and lastname = 'bar'
733   # CONNECT BY
734   #     parentid = prior persionid
735
736 =head2 order_siblings_by
737
738 =over 4
739
740 =item Value: ($order_siblings_by | \@order_siblings_by)
741
742 =back
743
744 Which column(s) to order the siblings by.
745
746 It uses the same syntax as L<DBIx::Class::ResultSet/order_by>
747
748   'order_siblings_by' => 'firstname ASC'
749
750   # SELECT
751   #     me.persionid me.firstname, me.lastname, me.parentid
752   # FROM
753   #     person me
754   # CONNECT BY
755   #     parentid = prior persionid
756   # ORDER SIBLINGS BY
757   #     firstname ASC
758
759 =head1 AUTHOR
760
761 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
762
763 =head1 LICENSE
764
765 You may distribute this code under the same terms as Perl itself.
766
767 =cut
768
769 1;
770 # vim:sts=2 sw=2: