if (! $_[0] or (ref $_[0] eq 'HASH' and !keys %{$_[0]} ) ) {
my $sql = "INSERT INTO ${table} DEFAULT VALUES";
- if (my @returning = @{ ($_[1]||{})->{returning} || [] }) {
- $sql .= ' RETURNING (' . (join ', ' => map $self->_quote($_), @returning)
- . ')';
+ if (my $ret = ($_[1]||{})->{returning} ) {
+ $sql .= $self->_insert_returning ($ret);
}
return $sql;
}
}
+sub _generate_join_clause {
+ my ($self, $join_type) = @_;
+
+ return sprintf ('%s JOIN ',
+ $join_type ? ' ' . uc($join_type) : ''
+ );
+}
+
sub _recurse_from {
my ($self, $from, @join) = @_;
my @sqlf;
$join_type = $self->{_default_jointype} if not defined $join_type;
- my $join_clause = sprintf ('%s JOIN ',
- $join_type ? ' ' . uc($join_type) : ''
- );
- push @sqlf, $join_clause;
+ push @sqlf, $self->_generate_join_clause( $join_type );
if (ref $to eq 'ARRAY') {
push(@sqlf, '(', $self->_recurse_from(@$to), ')');