[CDBI] Was it deleted?

Bill Moseley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
How do I know that $foo->delete actually deletes the object in the
database?

    my $foo = Foo->retrieve($id);

    # some other session deletes the row from the database

    $foo->delete;



Shouldn't this check the row count?


sub delete {
        my $self = shift;
        return $self->_search_delete(@_) if not ref $self;
        $self->remove_from_object_index;
        $self->call_trigger('before_delete');

        eval { $self->sql_DeleteMe->execute($self->id) };
        if ($@) {
                return $self->_db_error(
                        msg    => "Can't delete $self: $@",
                        err    => $@,
                        method => 'delete'
                );
        }
        $self->call_trigger('after_delete');
        undef %$self;
        bless $self, 'Class::DBI::Object::Has::Been::Deleted';
        return 1;
}





-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.