X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLMaker%2FOracle.pm;h=c7b36c50baaaf6fe0e3f725569575e3ece784ddd;hb=70c288086248e5a4008490df22a56632341f2473;hp=b05f3c23c168be0b7bc62fbc4637636a459f7b94;hpb=c7d50a7de2182fbfe933fa15b8015cb026f10c54;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLMaker/Oracle.pm b/lib/DBIx/Class/SQLMaker/Oracle.pm index b05f3c2..c7b36c5 100644 --- a/lib/DBIx/Class/SQLMaker/Oracle.pm +++ b/lib/DBIx/Class/SQLMaker/Oracle.pm @@ -5,12 +5,10 @@ use warnings; use strict; use base qw( DBIx::Class::SQLMaker ); -use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/; BEGIN { - use Carp::Clan qw/^DBIx::Class/; use DBIx::Class::Optional::Dependencies; - croak('The following extra modules are required for Oracle-based Storages ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') ) + die('The following extra modules are required for Oracle-based Storages ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') . "\n" ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener'); } @@ -27,7 +25,7 @@ sub new { sub _assemble_binds { my $self = shift; - return map { @{ (delete $self->{"${_}_bind"}) || [] } } (qw/from where oracle_connect_by having order/); + return map { @{ (delete $self->{"${_}_bind"}) || [] } } (qw/select from where oracle_connect_by group having order/); } @@ -109,6 +107,19 @@ sub _where_field_PRIOR { return ($sql, @bind); } +# use this codepath to hook all identifiers and mangle them if necessary +# this is invoked regardless of quoting being on or off +sub _quote { + my ($self, $label) = @_; + + return '' unless defined $label; + return ${$label} if ref($label) eq 'SCALAR'; + + $label =~ s/ ( [^\.]{31,} ) /$self->_shorten_identifier($1)/gxe; + + $self->next::method($label); +} + # this takes an identifier and shortens it if necessary # optionally keywords can be passed as an arrayref to generate useful # identifiers @@ -125,7 +136,7 @@ sub _shorten_identifier { return $to_shorten if length($to_shorten) <= $max_len; - croak 'keywords needs to be an arrayref' + $self->throw_exception("'keywords' needs to be an arrayref") if defined $keywords && ref $keywords ne 'ARRAY'; # if no keywords are passed use the identifier as one @@ -215,7 +226,7 @@ sub _insert_returning { }); my $rc_ref = $options->{returning_container} - or croak ('No returning container supplied for IR values'); + or $self->throw_exception('No returning container supplied for IR values'); @$rc_ref = (undef) x @f_names;