};
$opt{render} = {
- (map +($_, "_render_$_"), qw(op func bind ident literal row)),
+ (map +($_, "_render_$_"), qw(op func bind ident literal row values)),
%{$opt{render}||{}}
};
my @parts = ([ $self->_sqlcase('insert into').' '.$table ]);
push @parts, [ $self->render_aqt($f_aqt) ] if $f_aqt;
- push @parts, [ $self->render_aqt($v_aqt) ];
- $parts[-1][0] =~ s/^/VALUES /;
+ push @parts, [ $self->render_aqt({ -values => $v_aqt }) ];
if ($options->{returning}) {
push @parts, [ $self->_insert_returning($options) ];
return "($sql)", @bind;
}
+sub _render_values {
+ my ($self, $values) = @_;
+ my ($sql, @bind) = $self->_join_parts(
+ ', ',
+ map [ $self->render_aqt($_) ],
+ ref($values) eq 'ARRAY' ? @$values : $values
+ );
+ return $self->_sqlcase('values ').$sql, @bind;
+}
+
sub _render_func {
my ($self, $rest) = @_;
my ($func, @args) = @$rest;