diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/RHRD/rddb.pm | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 4f8f469..228f76c 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -2064,6 +2064,32 @@ sub create_multi_show return ($number, 'OK', 'success'); } +sub update_multi_show +{ + my $ctx = shift; + my $showid = shift; + my $title = shift; + my %shows = %{shift()}; + + my $showstr = join(";", map { "$_:$shows{$_}" } sort keys %shows); + + my $sql = qq{update CART set TITLE = ?, USER_DEFINED = ? where NUMBER = ?}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + my $cnt = $sth->execute($title, $showstr, $showid) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + $sth->finish(); + + unless($cnt == 1) { + return (undef, 'ERROR', 'multi-show does not exist'); + } + + return ($cnt, 'OK', 'success'); +} + sub get_multi_show_info { my ($ctx, $showid) = @_; @@ -2073,9 +2099,13 @@ sub get_multi_show_info my $sth = $ctx->{'dbh'}->prepare($sql) or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); - $sth->execute($showid) + my $cnt = $sth->execute($showid) or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + unless($cnt == 1) { + return (undef, 'ERROR', 'multi-show does not exist'); + } + my ($title, $shows) = $sth->fetchrow_array(); $sth->finish(); |