RWDE/DB/Deletable.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 1 SCAR 6.9
CC
1
Cov
0%
delete_record
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package RWDE::DB::Deletable;
2  
3 use strict;
4 use warnings;
5  
6 use vars qw($VERSION);
7 $VERSION = sprintf "%d", q$Revision: 508 $ =~ /(\d+)/;
8  
9 =pod
10  
11 =head2 delete_record()
12  
13 Delete the present record from the DB
14  
15 Requires the present record to be:
16 - populated
17 - have an index
18  
19 =cut
20  
21 sub delete_record {
22 my ($self, $params) = @_;
23  
24 my $dbh = $self->get_dbh();
25  
26 my $id_name = $self->{_id};
27 my $count = $dbh->do("DELETE FROM " . $self->{_table} . " WHERE " . $self->{_id} . "=" . $self->$id_name);
28  
29 return $count;
30 }
31  
32 1;