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 ],
);
}
example/DB/Default.pm view on Meta::CPAN
my $id = shift;
return {
$self->get_one_row_hash(
sql => "SELECT * FROM CMSUser WHERE id = ?",
bind => $id,
)
};
}
sub update_user {
my $self = shift;
my %p = @_;
if ($p{password}) {
$p{password_md5} = md5_hex($p{password});
}
$p{super_user} = $p{super_user} ? 't' : 'f';
$self->do_sql(
( run in 0.611 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )