From b03fc56082401474044c7f92f8786164ca0508a4 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 3 Oct 2008 06:37:16 +0000 Subject: Bug 456919: Implement Bugzilla::Field::Choice->remove_from_db and have editvalues.cgi use it Patch by Max Kanat-Alexander r=bbaetz, a=mkanat --- Bugzilla/Object.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Bugzilla/Object.pm') diff --git a/Bugzilla/Object.pm b/Bugzilla/Object.pm index cde440b95..532b2c5bc 100644 --- a/Bugzilla/Object.pm +++ b/Bugzilla/Object.pm @@ -290,6 +290,15 @@ sub update { return \%changes; } +sub remove_from_db { + my $self = shift; + my $table = $self->DB_TABLE; + my $id_field = $self->ID_FIELD; + Bugzilla->dbh->do("DELETE FROM $table WHERE $id_field = ?", + undef, $self->id); + undef $self; +} + ############################### #### Subroutines ###### ############################### @@ -726,6 +735,12 @@ C.) =back +=item C + +Removes this object from the database. Will throw an error if you can't +remove it for some reason. The object will then be destroyed, as it is +not safe to use the object after it has been removed from the database. + =back =head2 Subclass Helpers -- cgit v1.2.3-24-g4f1b