- Officially deprecate the 'cols' and 'include_columns' resultset
attributes
+ * Fixes
+ - Audit and correct potential bugs associated with braindead reuse
+ of $1 on unsuccessful matches
+
0.08209 2013-03-01 12:56 (UTC)
* New Features / Changes
- Debugging aid - warn on invalid result objects created by what
} elsif (ref $how eq "Regexp") {
$class->add_constraint(regexp => $col => sub { shift =~ $how });
} else {
- $how =~ m/([^:]+)$/;
+ $how =~ m/([^:]+)$/; # match is safe - we throw above on empty $how
my $try_method = sprintf '_constrain_by_%s', lc $1; # $how->moniker;
if (my $dispatch = $class->can($try_method)) {
$class->$dispatch($col => ($how, @_));
$f_key = $cond;
$guess = "caller specified foreign key '$f_key'";
} else {
- $class =~ /([^\:]+)$/;
+ $class =~ /([^\:]+)$/; # match is safe - $class can't be ''
$f_key = lc $1; # go ahead and guess; best we can do
$guess = "using our class name '$class' as foreign key";
}
for my $ch ($self->_order_by_chunks ($inner_order)) {
$ch = $ch->[0] if ref $ch eq 'ARRAY';
- $ch =~ s/\s+ ( ASC|DESC ) \s* $//ix;
- my $dir = uc ($1||'ASC');
- push @out_chunks, \join (' ', $ch, $dir eq 'ASC' ? 'DESC' : 'ASC' );
+ my $is_desc = (
+ $ch =~ s/\s+ ( ASC|DESC ) \s* $//ix
+ and
+ uc($1) eq 'DESC'
+ ) ? 1 : 0;
+ push @out_chunks, \join (' ', $ch, $is_desc ? 'ASC' : 'DESC' );
}
$sq_attrs->{order_by_middle} = $self->_order_by (\@out_chunks);
. 'unique-column order criteria.'
);
- $first_order_by =~ s/\s+ ( ASC|DESC ) \s* $//ix;
- my $direction = lc ($1 || 'asc');
+ my $direction = (
+ $first_order_by =~ s/\s+ ( ASC|DESC ) \s* $//ix
+ ) ? lc($1) : 'asc';
my ($first_ord_alias, $first_ord_col) = $first_order_by =~ /^ (?: ([^\.]+) \. )? ([^\.]+) $/x;
$sth->execute($table_name);
while (my ($trigger) = $sth->fetchrow_array) {
- my @trig_cols = map {
- /^"([^"]+)/ ? $1 : uc($1)
- } $trigger =~ /new\.("?\w+"?)/ig;
+ my @trig_cols = map
+ { /^"([^"]+)/ ? $1 : uc($_) }
+ $trigger =~ /new\.("?\w+"?)/ig
+ ;
my ($quoted, $generator) = $trigger =~
/(?:gen_id\s* \( \s* |next \s* value \s* for \s*)(")?(\w+)/ix;
));
}
- return $1;
+ return $1; # exception thrown unless match is made above
}
# custom method for fetching column default, since column_info has a
use base qw/DBIx::Class::Storage::DBI/;
-use List::Util 'first';
use namespace::clean;
__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::MySQL');
) {
# this is just a plain-ish name, which has been literal-ed for
# whatever reason
- $target_name = first { defined $_ } ($1, $2);
+ $target_name = (defined $1) ? $1 : $2;
}
else {
# this is something very complex, perhaps a custom result source or whatnot