Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better check if a proper list of values was passed to where

  • Loading branch information...
commit e4c0b5e9fc3e9fa6f097f2f231f5eec9efbf8249 1 parent 119faf9
Sergey authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 private/system/lib/Stuffed/System/Database.pm
View
6 private/system/lib/Stuffed/System/Database.pm
@@ -157,11 +157,11 @@ sub where {
my $q_field_name = $q_prefix . quote($field_name, start => '`');
- if (ref $in->{$field_name} eq 'ARRAY') {
+ if ( ref $in->{$field_name} eq 'ARRAY' and @{ $in->{$field_name} } ) {
push @where_arr, $q_field_name . ' in (' . join(',', map { $system->dbh->quote($_) } @{$in->{$field_name}}) . ')';
}
- elsif (ref $in->{$field_name} eq 'CODE') {
+ elsif ( ref $in->{$field_name} eq 'CODE' ) {
push @where_arr, $q_field_name . $in->{$field_name}->();
}
@@ -247,7 +247,7 @@ sub delete {
my $table = $self->{table} || return undef;
my $where_str = $self->where( @_ );
-
+
# we will not delete without a condition (all rows)
return undef if false( $where_str );
Please sign in to comment.
Something went wrong with that request. Please try again.