| 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; |