X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=68566f368c273eda2c6cd835b92c2b62a11b1035;hb=49eb5522ff64004f2fb7667b0e032555521bad32;hp=e6df357e0c0fb327fc76979c4c0d97e0564b298f;hpb=3f52831919a64ea6fb3269e41c547bc42e8db2fd;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index e6df357..68566f3 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -33,6 +33,11 @@ BEGIN { } } +# the "oh noes offset/top without limit" constant +# limited to 32 bits for sanity (and since it is fed +# to sprintf %u) +sub __max_int { 0xFFFFFFFF }; + # Tries to determine limit dialect. # @@ -118,7 +123,7 @@ sub _subqueried_limit_attrs { my (@in_sel, @out_sel, %renamed); for my $node (@sel) { if (first { $_ =~ / (?{as}, $node->{unquoted_sql}) ) { - $node->{as} =~ s/ $re_sep /__/xg; + $node->{as} = $self->_unqualify_colname($node->{as}); my $quoted_as = $self->_quote($node->{as}); push @in_sel, sprintf '%s AS %s', $node->{sql}, $quoted_as; push @out_sel, $quoted_as; @@ -154,6 +159,13 @@ sub _subqueried_limit_attrs { ); } +sub _unqualify_colname { + my ($self, $fqcn) = @_; + my $re_sep = quotemeta($self->name_sep || '.'); + $fqcn =~ s/ $re_sep /__/xg; + return $fqcn; +} + # ANSI standard Limit/Offset implementation. DB2 and MSSQL >= 2005 use this sub _RowNumberOver { my ($self, $sql, $rs_attrs, $rows, $offset ) = @_; @@ -810,7 +822,7 @@ sub _join_condition { } elsif (ref $cond eq 'ARRAY') { return join(' OR ', map { $self->_join_condition($_) } @$cond); } else { - die "Can't handle this yet!"; + croak "Can't handle this yet!"; } }