blib/lib/AutoSQL/DBSQL/ObjectAdaptor/Remove.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
remove_by_dbID
2.0
remove_all
2.0
_remove_by_where
2.0
CRAP 2.0
1 package AutoSQL::DBSQL::ObjectAdaptor;
2 use strict;
3 use AutoSQL::DBSQL::ObjectAdaptor::Abstract;
4 our @ISA=qw(AutoSQL::DBSQL::ObjectAdaptor::Abstract);
5  
6 sub remove_by_dbID {
7 my ($self, $dbid)=@_;
8 my $where = $self->_primary_key_name .' = ?';
9 $self->_remove_by_where($where, $dbid);
10 }
11
12 sub remove_all {
13 shift->_remove_by_where('1');
14 }
15
16 sub _remove_by_where {
17 my ($self, $where, @values)=@_;
18 my $sql="DELETE FROM ". $self->_table_name ;
19 $sql .= " WHERE $where";
20 my $sth=$self->prepare($sql);
21 $sth->execute(@values);
22 }
23
24
25 1;