DBIx-AnyDBD

 view release on metacpan or  search on metacpan

example/DB/Default.pm  view on Meta::CPAN

                    WHERE 1 = 1
                    " .
                  ($p{asset_id} ? " AND WebItem.id = ? " : "") .
                  ($p{status} ? " AND ItemStatus.description = ? " : "") .
                  ($p{type} ? " AND ItemType.short_desc = ? " : "") .
                  ($p{include_expired} ? "" : "AND WebItem.date_expires > now()"),
            (@bind ? (bind => \@bind) : ()),
            );
}

sub update_announce {
    my $self = shift;
    my %p = @_;
    
    $p{expires} = $self->sql_date_struct($p{expires});
    $p{live} = $self->sql_date_struct($p{live});
    
    $self->do_sql(
            sql => "UPDATE WebItem
                    SET title = ?,
                        link = ?,
                        date_expires = ?,
                        date_live = ?
                    WHERE id = ?",
            bind => [ @p{qw(title link expires live id)} ],
            );
}

sub update_news {
    my $self = shift;
    my %p = @_;
    
    $p{expires} = $self->sql_date_struct($p{expires});
    $p{live} = $self->sql_date_struct($p{live});
    
    $self->do_sql(
            sql => "UPDATE WebItem
                    SET title = ?,
                        link = ?,
                        date_expires = ?,
                        date_live = ?
                    WHERE id = ?",
            bind => [ @p{qw(title link expires live id)} ],
            );
}

sub update_event {
    my $self = shift;
    my %p = @_;
    
    $p{expires} = $self->sql_date_struct($p{expires});
    $p{live} = $self->sql_date_struct($p{live});
    
    $self->do_sql(
            sql => "UPDATE WebItem
                    SET title = ?,
                        link = ?,
                        date_expires = ?,
                        date_live = ?,
                        location = ?,
                        booth = ?
                    WHERE id = ?",
            bind => [ @p{qw(title link expires live location booth id)} ],
            );
}

sub update_pr {
    my $self = shift;
    my %p = @_;
    
    $p{expires} = $self->sql_date_struct($p{expires});
    $p{live} = $self->sql_date_struct($p{live});
    
    $self->do_sql(
            sql => "UPDATE WebItem
                    SET title = ?,
                        date_expires = ?,
                        date_live = ?,
                        subtitle = ?,
                        location = ?,
                        body = ?
                    WHERE id = ?",
            bind => [ @p{qw(title expires live subtitle location body id)} ],
            );
}

sub update_asset_column {
    my $self = shift;
    my ($id, $column, $value) = @_;
    
    $self->do_sql(
                sql => "UPDATE WebItem
                        SET $column = ?
                        WHERE id = ?",
                bind => [ $value, $id ],
                );
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.570 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )