Trying to move towards enabling warnings.
Add warn for unknown $query_type.
Use common $dbh.
push @array, ({key1=>value1...}); is the same as
push @array, {key1=>value1...};
if ( scalar(@$arrayref) > 0 ) is the same as
if (scalar @$arrayref)
Lines like:
my @operators = @$operators if $operators;
are bad because we need @operators to be declared and in scope later,
even if it is undef. Without $operators, the variable is not in scope.