diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-30 12:47:28 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-30 12:47:28 (GMT) |
commit | 3a09a75ce87c867c2f3efc1cf20ff1557cd0647d (patch) | |
tree | 9088f5e8399db278e36e6d1a00e4cafba8fa625a /lib/RHRD/rddb.pm | |
parent | f502cf1e7d2c433fb11fc47e6f106ef612d43c57 (diff) |
add check if automation/show id exist when generating log
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-x | lib/RHRD/rddb.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index a3c4f7a..df514d7 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -1105,6 +1105,24 @@ sub list_showids return @showids; } +sub check_show_exists +{ + my ($ctx, $showid) = @_; + + my $sql = qq{select count(*) from CART where NUMBER = ?}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + $sth->execute($showid) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my ($result) = $sth->fetchrow_array(); + $sth->finish(); + + return ($result, 'OK', "successfully fetched show status"); +} + sub create_show_group { my ($ctx, $groupname) = @_; |