Re: [CDBI] Committing on delete
Michael Peters <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Nick Peters wrote: > Hi, I'm sorry about having to ask such a basic question. > > I'm trying to add transactions to my database. I have been able to > commit insertions and edit records but I really can't work out how to > commit deletions. > > Trying update or dbi_commit on the object I have just deleted gives me > the error "Can't locate object method "x" via package > "Class::DBI::Object::Has::Been::Deleted" which I can understand as I'm > trying to call it on an object I have just deleted but I can't work out > how I am meant to commit the change. dbi_commit() is actually a class method, not an object method. It works when you call it on an object, but that's just a side-effect. In fact, it's confusing to call it as an object method since it doesn't just commit that object, but everything since your last commit. I would recommend that you always call it like so: MyApp::DB->dbi_commit(); -- Michael Peters Developer Plus Three, LP