From: Peter Rabbitson Date: Tue, 1 Jun 2010 00:28:05 +0000 (+0000) Subject: Minor touches/changes X-Git-Tag: v0.08122~34^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=49afd714d07305e6567d38e5f83df0f90e0f2793;p=dbsrgits%2FDBIx-Class.git Minor touches/changes --- diff --git a/Changes b/Changes index 3fb0f4d..f88b46f 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,8 @@ Revision history for DBIx::Class - InflateColumn::DateTime support for MSSQL via DBD::Sybase - Millisecond precision support for MSSQL datetimes for InflateColumn::DateTime + - Oracle-specific hierarchical query syntax support: + CONNECT BY (NOCYCLE) / START WOTH / ORDER SIBLINGS BY - Support connecting using $ENV{DBI_DSN} and $ENV{DBI_DRIVER} - current_source_alias method on ResultSet objects to determine the alias to use in programatically assembled diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index 392c887..d1c6b89 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -516,15 +516,15 @@ sub select { croak "LIMIT 0 Does Not Compute" if $rest[0] == 0; # and anyway, SQL::Abstract::Limit will cause a barf if we don't first - my $sql = ''; - ($sql, @{$self->{where_bind}}) = $self->SUPER::select( + my ($sql, @bind) = $self->SUPER::select( $table, $self->_recurse_fields($fields), $where, $rs_attrs, @rest ); + push @{$self->{where_bind}}, @bind; # this *must* be called, otherwise extra binds will remain in the sql-maker - my @bind = $self->_assemble_binds; + my @all_bind = $self->_assemble_binds; - return wantarray ? ($sql, @bind) : $sql; + return wantarray ? ($sql, @all_bind) : $sql; } sub _assemble_binds { diff --git a/lib/DBIx/Class/SQLAHacks/Oracle.pm b/lib/DBIx/Class/SQLAHacks/Oracle.pm index 5f77a60..4274939 100644 --- a/lib/DBIx/Class/SQLAHacks/Oracle.pm +++ b/lib/DBIx/Class/SQLAHacks/Oracle.pm @@ -7,12 +7,6 @@ use strict; use base qw( DBIx::Class::SQLAHacks ); use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/; -# -# TODO: -# - Review by experienced DBIC/SQL:A developers :-) -# - Problem with count and connect_by look the TODO in t/73oracle.t -# - sub new { my $self = shift; my %opts = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_; @@ -30,14 +24,16 @@ sub _assemble_binds { } -sub _emulate_limit { - my ( $self, $syntax, $sql, $rs_attrs, $rows, $offset ) = @_; +sub _parse_rs_attrs { + my $self = shift; + my ($rs_attrs) = @_; my ($cb_sql, @cb_bind) = $self->_connect_by($rs_attrs); - $sql .= $cb_sql; - $self->{oracle_connect_by_bind} = \@cb_bind; + push @{$self->{oracle_connect_by_bind}}, @cb_bind; + + my $sql = $self->SUPER::_parse_rs_attrs(@_); - return $self->SUPER::_emulate_limit($syntax, $sql, $rs_attrs, $rows, $offset); + return "$cb_sql $sql"; } sub _connect_by {