die "No" if @rest;
die "Not a node type: $k" unless $k =~ s/^-//;
if (my $meth = $self->{render}{$k}) {
- return $self->$meth($v);
+ return $self->$meth($k, $v);
}
die "notreached: $k";
}
}
sub _render_ident {
- my ($self, $ident) = @_;
+ my ($self, undef, $ident) = @_;
return $self->_convert($self->_quote($ident));
}
sub _render_row {
- my ($self, $values) = @_;
- my ($sql, @bind) = $self->_render_op([ ',', @$values ]);
+ my ($self, undef, $values) = @_;
+ my ($sql, @bind) = $self->_render_op(undef, [ ',', @$values ]);
return "($sql)", @bind;
}
sub _render_func {
- my ($self, $rest) = @_;
+ my ($self, undef, $rest) = @_;
my ($func, @args) = @$rest;
if (ref($func) eq 'HASH') {
$func = $self->render_aqt($func);
}
sub _render_bind {
- my ($self, $bind) = @_;
+ my ($self, undef, $bind) = @_;
return ($self->_convert('?'), $self->_bindtype(@$bind));
}
sub _render_literal {
- my ($self, $literal) = @_;
+ my ($self, undef, $literal) = @_;
$self->_assert_bindval_matches_bindtype(@{$literal}[1..$#$literal]);
return @$literal;
}
sub _render_op {
- my ($self, $v) = @_;
+ my ($self, undef, $v) = @_;
my ($op, @args) = @$v;
if (my $r = $self->{render_op}{$op}) {
return $self->$r($op, \@args);
my ($self) = @_;
$self->{clauses_of}{select} = [ qw(select from where order_by) ];
$self->{expand}{select} = sub { shift->_expand_statement(@_) };
- $self->{render}{select} = sub { shift->_render_statement(select => @_) };
+ $self->{render}{select} = sub { shift->_render_statement(@_) };
$self->{expand_clause}{"select.$_"} = "_expand_select_clause_$_"
for @{$self->{clauses_of}{select}};
$self->{clauses_of}{update} = [ qw(target set where returning) ];
$self->{expand}{update} = sub { shift->_expand_statement(@_) };
- $self->{render}{update} = sub { shift->_render_statement(update => @_) };
+ $self->{render}{update} = sub { shift->_render_statement(@_) };
$self->{expand_clause}{"update.$_"} = "_expand_update_clause_$_"
for @{$self->{clauses_of}{update}};
$self->{expand_clause}{'update.update'} = '_expand_update_clause_target';
};
$self->{clauses_of}{delete} = [ qw(target where returning) ];
$self->{expand}{delete} = sub { shift->_expand_statement(@_) };
- $self->{render}{delete} = sub { shift->_render_statement(delete => @_) };
+ $self->{render}{delete} = sub { shift->_render_statement(@_) };
$self->{expand_clause}{"delete.$_"} = "_expand_delete_clause_$_"
for @{$self->{clauses_of}{delete}};
$self->{expand_clause}{"delete.from"} = '_expand_delete_clause_target';
'target', 'fields', 'from', 'returning'
];
$self->{expand}{insert} = sub { shift->_expand_statement(@_) };
- $self->{render}{insert} = sub { shift->_render_statement(insert => @_) };
+ $self->{render}{insert} = sub { shift->_render_statement(@_) };
$self->{expand_clause}{'insert.into'} = '_expand_insert_clause_target';
$self->{expand_clause}{'insert.target'} = '_expand_insert_clause_target';
$self->{expand_clause}{'insert.fields'} = sub {
}
sub _render_values {
- my ($self, $values) = @_;
+ my ($self, undef, $values) = @_;
my ($v_sql, @bind) = $self->join_clauses(
', ',
map [ $self->render_aqt($_) ],
foreach my $setop (qw(union intersect except)) {
$self->renderer($setop => sub {
- my ($self, $args) = @_;
+ my ($self, undef, $args) = @_;
$self->join_clauses(
' '.$self->format_keyword(join '_', $setop, ($args->{type}||())).' ',
map [ $self->render_aqt($_) ], @{$args->{queries}}
}
sub _render_from_list {
- my ($self, $list) = @_;
+ my ($self, undef, $list) = @_;
return $self->join_clauses(', ', map [ $self->render_aqt($_) ], @$list);
}
sub _render_join {
- my ($self, $args) = @_;
+ my ($self, undef, $args) = @_;
my @parts = (
[ $self->render_aqt($args->{from}) ],
}
sub _render_as {
- my ($self, $args) = @_;
+ my ($self, undef, $args) = @_;
my ($thing, @alias) = @$args;
return $self->join_clauses(
' ',