diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-09-14 20:49:08 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-09-14 21:04:40 (GMT) |
commit | df8affb33e4230860545b4a3e36eb791363a341f (patch) | |
tree | 499fa8229352219fea32db8e773891c87bbd7d6e /lib | |
parent | 444c7d9f9da66309ed0e4e2d6d7050ecc436b0fc (diff) |
implemented multi-edit
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(); |