use Carp qw/croak/;
class_type 'SQL::Abstract';
- clean;
has logic => (
is => 'rw',
push @values, { -type => 'value', value => $fields->{$_} };
}
+ $ast->{where} = $self->recurse_where($where)
+ if defined $where;
+
return $ast;
}
};
}
- method recurse_where(WhereType $ast, LogicEnum $logic?) returns (AST) {
+ method recurse_where(WhereType $ast, LogicEnum $logic?) {
return $self->recurse_where_hash($logic || 'AND', $ast) if is_HashRef($ast);
return $self->recurse_where_array($logic || 'OR', $ast) if is_ArrayRef($ast);
croak "Unknown where clause type " . dump($ast);
}
# Deals with where({ .... }) case
- method recurse_where_hash(LogicEnum $logic, HashRef $ast) returns (AST) {
+ method recurse_where_hash(LogicEnum $logic, HashRef $ast) {
my @args;
my $ret = {
-type => 'expr',
}
# Deals with where([ .... ]) case
- method recurse_where_array(LogicEnum $logic, ArrayRef $ast) returns (AST) {
+ method recurse_where_array(LogicEnum $logic, ArrayRef $ast) {
my @args;
my $ret = {
-type => 'expr',
}
# { field => { .... } } case
- method field_hash(Str $key, HashRef $value) returns (AST) {
+ method field_hash(Str $key, HashRef $value) {
my ($op, @rest) = keys %$value;
confess "Don't know how to handle " . dump($value) . " (too many keys)"
};
}
- method field(Str $key, $value) returns (AST) {
+ method field(Str $key, $value) {
if (is_HashRef($value)) {
return $self->field_hash($key, $value);
return $ret;
}
- method value($value) returns (AST) {
+ method value($value) {
return $self->apply_convert( { -type => 'value', value => $value })
if is_Str($value);