Fey

 view release on metacpan or  search on metacpan

lib/Fey/SQL/Update.pm  view on Meta::CPAN

    default => sub { [] },
    handles => {
        _add_set_pair => 'push',
        _set_pairs    => 'elements',
    },
    init_arg => undef,
);

with 'Fey::Role::SQL::Cloneable';

sub update {
    my $self = shift;

    my $count = @_ ? @_ : 1;
    my (@tables) = pos_validated_list(
        \@_,
        ( ( { isa => Table } ) x $count ),
        MX_PARAMS_VALIDATE_NO_CACHE => 1,
    );

    $self->_set_update( \@tables );

lib/Fey/SQL/Update.pm  view on Meta::CPAN

    return (
        join ' ',
        $self->update_clause($dbh),
        $self->set_clause($dbh),
        $self->where_clause($dbh),
        $self->order_by_clause($dbh),
        $self->limit_clause($dbh),
    );
}

sub update_clause {
    return 'UPDATE ' . $_[0]->_tables_subclause( $_[1] );
}

sub _tables_subclause {
    return (
        join ', ',
        map { $_[1]->quote_identifier( $_->name() ) } @{ $_[0]->_update() }
    );
}



( run in 0.281 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )